Time Library Organisation
ashley at semantic.org
Fri Jan 28 21:48:29 EST 2005
In article <87llaeobbu.fsf at qrnik.zagroda>,
Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:
> For example there would be new syscalls for TAI time; a new kernel
> would treat the hardware clock as TAI and compute UTC from this when
> a process asks for gettimeofday (which is more accurate than the other
> direction); glibc would nevertheless translate in the other direction
> when run on an old kernel, so programs would work at all; and there
> would be a central place to keep the leap second table, with a special
> program to notify the kernel about updates (which would propagate to
> running processes); and NTP clients would be enhanced to use the new
> API when avaiable.
This turns out not at all hard to do in Linux with a kernel module,
since they can intercept system calls and provide new ones very easily.
Incidentally, I came across an amusing solution to make gettimeofday
always tell correct UTC time, from <http://lkml.org/lkml/1998/9/9/50>:
> Actually, I think Ulrich was present when I proposed a similar solution:
> gettimeofday() will not return during 23:59:60. If a process calls
> gettimeofday() during a leap second, then the call will sleep until 0:00:00
> when it can return the correct result.
> This horrified the real-time people. It is, however, strictly speaking,
> completely correct.
Ashley Yakeley, Seattle WA
More information about the Libraries