
On 28 January 2005 21:54, Ketil Malde wrote:
Ashley Yakeley
writes: It seems what should have been done was to create a patch to the kernel that allows the hardware clock to run on TAI but have gettimeofday return broken time as per POSIX, and have some other function to return TAI time. Perhaps someone's done this.
I tried to find out, with no success. Anybody? I'm about to reinstall my Linux laptop after a disk crash, so I could try to do this. It also appears that support is needed in NTP, although I'm not sure why.
I don't know about the NTP support, but at least with GNU libc you can use a system clock set to TAI:
TZ=Europe/London date Mon Jan 31 09:42:47 GMT 2005 TZ=right/Europe/London date Mon Jan 31 09:42:26 GMT 2005
when TZ is set to "right/..." glibc assumes the system clock is set to TAI seconds since the epoch. Of course, there's still no way for a user program to tell whether the system clock is supposed to be TAI or UTC. Cheers, Simon

"Simon Marlow"
I don't know about the NTP support, but at least with GNU libc you can use a system clock set to TAI:
TZ=Europe/London date Mon Jan 31 09:42:47 GMT 2005 TZ=right/Europe/London date Mon Jan 31 09:42:26 GMT 2005
If gmtime returns the TAI time (which I would expect, since it assigns the TAI-UTC difference to the timezone), then a program trying to determine the local timezone offset (to output a Date header in email for example) may get confused by not getting an integral number of minutes. If gmtime returns the UTC time, then it gives different results than a "portable" reimplementation of gmtime. Or, worse, it's incompatible wit the inverse of gmtime, which is more likely to be implemented by hand because it isn't provided by standard C (it only provides mktime, an inverse of localtime; GNU C provides timegm as an extension). -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/

On 2005-01-31, Simon Marlow
when TZ is set to "right/..." glibc assumes the system clock is set to TAI seconds since the epoch.
Of course, there's still no way for a user program to tell whether the system clock is supposed to be TAI or UTC.
Right. If we only cared about glibc systems (and a few others, I believe a couple of the *BSDs may also have this available), TZ would be a reasonable heuristic (it fails even there because of /etc/timezone) -- Aaron Denney -><-
participants (3)
-
Aaron Denney
-
Marcin 'Qrczak' Kowalczyk
-
Simon Marlow