[LEAPSECS] POSIX and C (Was: Re: ISO Influence)

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Dec 19 04:07:14 EST 2010


In message <1292742460.31540.137.camel at localhost>, Paul Sheer writes:


>There are three POSIX functions which convert between broken down time

>format (aka YYYY-MM-DD HH:MM:SS) to a seconds-since-1970 scalar value.

>

>They are gmtime(), localtime(), and mktime()


Actually modern ISO-C contains a whole slew of hacks in addition to
that. See section 7.23.


>There is no fourth function to do the inverse of gmtime().


ISO-C introduced the "tmx" struct, which is a "tm" struct qualified
by timezone info, so you can do this with the *xtime functions.


>For this and other reasons many programs implement their own function to

>do this. They would assume 86400 seconds per day to copy POSIX or

>because they have never heard of leap seconds. I would guess there are

>an enormous number of statically linked executables that contain such

>code.


Well, enourmous or not, we simply do not know, and Rob doesn't think
it is so important to find them, that we should develop a time-estimate
for how long time it will take.


>At this "late" stage in Unix software evolution the genie is out of the

>bottle. You can change the standard to whatever you like, but I guess

>few would comply.


The xtime() functions have been here for most of a decade and few people
know about them...

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.


More information about the LEAPSECS mailing list