On Wed, 2010-04-07 at 11:57 +1000, Jamie Wilkinson wrote: > On 3 April 2010 12:51, Nick Andrew <[email protected]> wrote: > > Pity that unix time_t ignores leap seconds :-) > > And the corollary that anyone using ntpd or other time synchronisation > discipline now has a gettimeofday() that breaks the POSIX definition.
The point of an operating system is to present a useful abstraction of the hardware, including the time of day clock. An abstraction which includes all the arcana of timekeeping isn't actually that useful for most applications. time_t -- despite its shortcomings -- is a fine abstraction, so much so that most operating systems designed since have stolen this abstraction rather than use a structure of Y/M/D H:M:S as done by pre-UNIX operating systems. If you do need to track the arcana then there are multiple abstractions of increasing complexity, all of which are deficient for some users, all of which are less and less useful to everyday applications. Dissing time_t because it is so simple is to miss the point. It is a good abstraction because it is simple and the majority of the applications which use it wouldn't know or care what to do with a leap second. As for the specific point, there's nothing to stop difftime() applying leap second adjustments. -- Glen Turner www.gdt.id.au/~gdt -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
