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.)
# echo $[`date +%s`-`tr ' ' . < /proc/uptime | cut -d . -f 1`]
927768214
# grep btime /proc/stat
btime 927768214
# date 05312240
Mon May 31 22:40:00 PDT 1999
# echo $[`date +%s`-`tr ' ' . < /proc/uptime | cut -d . -f 1`]
927767974
# grep btime /proc/stat
btime 927767974
# uname -a
Linux gal 2.0.36 #1 Wed May 12 14:28:16 PDT 1999 i686 unknown
-
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/