lkml.org 
[lkml]   [1999]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How can Emacs get a unique ID per Linux reboot?
Hi Paul.

>> echo $[`date +%s`-`tr ' ' . < /proc/uptime | cut -d . -f 1`]

>> ...as, at least on my system, that returns a constant value.

> On my system, /proc/uptime is unaffected when I change the
> clock, which means that subtracting the uptime from the current
> time is not reliable. E.g. see the transcript below, which
> demonstrates that current_time - uptime == btime. Hencie
> neither suffices for a unique ID per reboot. (I think btime is
> broken whereas uptime is OK.)

In that case, try the following variant thereof...

> echo $[`TZ=UTC date +%s`-`cut -d . -f 1 < /proc/uptime`]

OK, if you're going to deliberately mangle your system clock in some
random way, then that will break, but if you're referring to changes
from winter to summer time and back again, then the above will deal
with that quite happily...

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.082 / U:0.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site