Re: localtime()

Thorsten Glaser <[email protected]> Tue, 6 Dec 2011 09:30:17 +0100 (CET)
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
On Mon, 5 Dec 2011, Laurent Bercot wrote:

> > No, applications rightfully expect that time(3) and gettimeofday(2)
> > have the same scale.
> 
>  Well, if you allow no discrepancy between gettimeofday(2) and time(3),
> then you have no other choice but patch the kernel indeed. A POSIX kernel
> won't allow you to use right/ timezones, which is a shame.

It will, if either the kernel never needs to provide a broken-down
time (AFAIK, no standard *nix API will), or you don’t care about the
values of them (for example, on a typical i386 system, the time is
stored in the RTC across reboots, so if you’re not dual-booting with
other OSes, it could be used and the BIOS time is 24s off).

Of course, in MirBSD, the kernel is patched to know about leap seconds.
The table is compiled in, though.

> >>  Unfortunately, as you say, programs such as ntpd and rdate are not
> > Some are. Mine are.
> 
>  Well, if you have written a flexible implementation of ntpd, please
> share it ! :) Can I use it on Linux or is it BSD-only ?

I’ve just checked, I’ve gotten into the habit of making Debian packages
of my software; the rdate (SNTP client) package already has it:
https://www.freewrt.org/~tg/debs/dists/lenny/wtf/Pkgs/rdate/
Overview page: https://www.freewrt.org/~tg/debs/debidx.htm

The openntpd package doesn’t yet have it, but I’ll note on my
TODO to add the functionality there and update the package.
(Hrm, could check whether it’ll build against dietlibc in the
same go.) Don’t hold your breath for it, but this should be
less time-consuming than adding it to dietlibc (which I’ll
nevertheless do at some point).

bye,
//mirabilos
-- 
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”	(#nosec)    ‣‣‣ Please let MySQL and MariaDB finally die!