Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.killfile.org!.POSTED!not-for-mail From: c28f62@TheWorld.com (Mark Kramer) Newsgroups: comp.os.linux.misc,comp.sys.raspberry-pi Subject: Re: Keeping 'order' without RTC. Date: Tue, 12 May 2015 06:09:08 +0000 (UTC) Organization: The World : www.TheWorld.com : Since 1989 Lines: 50 Message-ID: References: NNTP-Posting-Host: shell01.theworld.com X-Trace: flea.killfile.org 1431410948 5326 192.74.137.71 (12 May 2015 06:09:08 GMT) X-Complaints-To: news@usenet.killfile.org X-Newsreader: trn 4.0-test72 (19 April 1999) Xref: csiph.com comp.os.linux.misc:14762 In article , William Unruh wrote: >On 2015-05-04, Mark Kramer wrote: >> The software clock is not an RTC. It counts interrupts. Yes, you can >> decode that count to a wallclock time, but that extra step is an extra >> step for a true RTC. > >Agreed. It counts "seconds" (well after it has been calibrated) No, it counts interrupts. The frequency of interrupts depends on the hardware. For old DOS on a PC, it was 18.2Hz. For some linuxes I've used, it is 1kHz. Some were, as I recall, 100Hz. >but >those are at best "seconds since the machine has been turned on". Since that counter can be set to any value, and is set by the time-setting commands, no, it isn't "at best" a simple counter of power-on ticks, it is "at best" a counter of some multiple of seconds since 1 Jan 1970 0000 GMT. >To >have it count useful seconds (eg seconds since Jan 1 1970) you need to >feed it the Real Time at one of those seconds. Taht is the job of the >Real Time Clock. Which the Pi does not have unless you've added that hardware. Otherwise, it is the job of the user, or of the NTP demon. >Note that the Real Time Clock also counts seconds. I've had an RTC that did quite well at counting 0.01 seconds. None of them I know actually count seconds. They count to 60 and then go back to 0 while incrementing a counter called "minutes". A 32.something kHz crystal is very common. >Seconds since epoch IS a "real time" Seconds since the computer was >switched on is not. Seconds since epoch is not "real time". It is a count of seconds since an arbitrary point in time. >> On the other hand, the true RTC devices do maintain the "real time". >> You can ask it directly "what hour of the day is it?" because its API >> returns hour of the day. You don't have to get a 32 or 64 bit integer and > >Actually intrnally it too just keeps count of seconds. No. It keeps count of seconds of the minute, minute of the hour, hour of the day, etc...