Groups | Search | Server Info | Login | Register


Groups > comp.os.linux.development.system > #357

Re: Getting time of last reboot on Linux

From gordonb.xm1tg@burditt.org (Gordon Burditt)
Subject Re: Getting time of last reboot on Linux
Newsgroups comp.os.linux.development.system, comp.unix.programmer
References <4c0afddf-5e6e-41f5-b8d2-b65afcc4ee29@z1g2000vbx.googlegroups.com> <RjqHq.27421$c27.19904@newsfe22.iad> <k5t4s8-sr2.ln1@wilbur.25thandClement.com> <kxQHq.31305$U16.23953@newsfe15.iad>
Message-ID <pc2dnV-3uITQVm_TnZ2dnUVZ_tydnZ2d@posted.internetamerica> (permalink)
Date 2011-12-22 00:16 -0600

Cross-posted to 2 groups.

Show all headers | View raw


> System clock changes are usually recorded in utmp(x) NEW_TIME and OLD_TIME
> records. Perhaps a thoroughly accurate reboot time accounting would need to
> interpret BOOT_TIME, NEW_TIME, and OLD_TIME records to produce a reboot
> timestamp that reflects the current clock.
> 
> Question: how likely is your scenario? That is, in (say) 1000 reboots of an
> aribtrary machine, how often would NTP radically reset the system clock?

Would that be 100% on systems where the time is supposedly kept
running while the system is powered off, and the CMOS battery to
keep that time running is failing / has failed (but you cannot
detect that it has failed without knowing what year it is)?

I would expect that it would be near 100% on systems where there
is no real-time-clock kept alive when the system is powered off,
and the system has to resort to a mod time on the root superblock
from shutdown.  Scheduled shutdowns (systems not expected to run
anywhere close to 24/7 for power-saving, security, noise, or other
reasons) or shutdowns for hardware reconfiguration are likely to
take more than 10 minutes.  I'll assume that the system is robust
enough not to have a lot of panic/immediate reboot cycles.

(I'll assume that "radically reset" involves times larger than, say,
10 minutes or a few hours, and could easily involve decades.)

It may well be that on aging (PC-like) desktops and servers, nobody
notices a failed CMOS clock because time is set from the network
by NTP, and time stamps generated during single-user boots aren't
used much.  (Yes, this would include modern Windows systems set up
to get time from the network.)  I suspect that the situation may be
the same on laptops, which do not seem to lose the time even if you
remove (both) batteries and the AC adapter *if* it's a reasonably
new laptop.

Back to comp.os.linux.development.system | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Getting time of last reboot on Linux Alex Vinokur <alex.vinokur@gmail.com> - 2011-12-18 09:35 -0800
  Re: Getting time of last reboot on Linux Steve Thompson <smt@vgersoft.com> - 2011-12-18 12:46 -0500
    Re: Getting time of last reboot on Linux Alex Vinokur <alex.vinokur@gmail.com> - 2011-12-18 10:12 -0800
      Re: Getting time of last reboot on Linux Volker Birk <bumens@dingens.org> - 2011-12-18 18:19 +0000
        Re: Getting time of last reboot on Linux Andrew Smallshaw <andrews@sdf.lonestar.org> - 2011-12-21 16:01 +0000
  Re: Getting time of last reboot on Linux Volker Birk <bumens@dingens.org> - 2011-12-18 18:18 +0000
  Re: Getting time of last reboot on Linux Lew Pitcher <lpitcher@teksavvy.com> - 2011-12-18 13:31 -0500
    Re: Getting time of last reboot on Linux Stephane CHAZELAS <stephane_chazelas@yahoo.fr> - 2011-12-18 21:48 +0000
      Re: Getting time of last reboot on Linux Barry Margolin <barmar@alum.mit.edu> - 2011-12-18 21:29 -0500
        Re: Getting time of last reboot on Linux Stephane CHAZELAS <stephane_chazelas@yahoo.fr> - 2011-12-19 12:59 +0000
    Re: Getting time of last reboot on Linux William Ahern <william@wilbur.25thandClement.com> - 2011-12-19 15:15 -0800
      Re: Getting time of last reboot on Linux Lew Pitcher <lpitcher@teksavvy.com> - 2011-12-19 19:20 -0500
        Re: Getting time of last reboot on Linux William Ahern <william@wilbur.25thandClement.com> - 2011-12-19 18:32 -0800
        Re: Getting time of last reboot on Linux gordonb.xm1tg@burditt.org (Gordon Burditt) - 2011-12-22 00:16 -0600
          Re: Getting time of last reboot on Linux Stefan Monnier <monnier@iro.umontreal.ca> - 2012-01-09 09:18 -0500
      Re: Getting time of last reboot on Linux Ivan Shmakov <oneingray@gmail.com> - 2011-12-20 11:48 +0700
  Re: Getting time of last reboot on Linux Richard Kettlewell <rjk@greenend.org.uk> - 2011-12-21 17:06 +0000
    Re: Getting time of last reboot on Linux gazelle@shell.xmission.com (Kenny McCormack) - 2012-02-09 17:25 +0000
      Re: Getting time of last reboot on Linux Richard Kettlewell <rjk@greenend.org.uk> - 2012-02-09 21:11 +0000

csiph-web