

Modernized time.h for ISO C (1998) - mr_tyzic
http://www.cl.cam.ac.uk/~mgk25/time/c/

======
Dylan16807
Why does TAI start with an offset of 10 seconds? 1972-01-01 is before any leap
seconds.

Edit: I can see it matches the right value but I can't figure out why. There
have been 25 leap seconds but there's a 35 second offset...

Edit 2: Apparently the clocks ran at _different speeds_ for a decade, and the
difference got rounded to 10 in 1972.

~~~
DiabloD3
I find that extremely interesting. Can you cite this for the lazy?

~~~
Dylan16807
[http://en.wikipedia.org/wiki/Leap_second#History](http://en.wikipedia.org/wiki/Leap_second#History)
last paragraph of the section

------
cremno
`struct xtime` and `xtime_get` were added in C11 as `struct timespec` and
`timespec_get`:

[http://port70.net/~nsz/c/c11/n1570.html#7.27.1p3](http://port70.net/~nsz/c/c11/n1570.html#7.27.1p3)

[http://port70.net/~nsz/c/c11/n1570.html#7.27.2.5](http://port70.net/~nsz/c/c11/n1570.html#7.27.2.5)

There are some differences though. Not only the name and types differ. But
also `timespec_get` is only required to support `TIME_UTC` and the
specification is not as detailed.

~~~
cremno
Also, some proposed conversion specifiers are part of C99: %z and %l / %L as
%Z.

------
TeMPOraL
As a reminder of how painful and complicated dealing with time is, here is an
excellent essay by Erik Naggum:

[http://naggum.no/lugm-time.html](http://naggum.no/lugm-time.html)

~~~
andygmb
I feel like Tom Scott did a great job summing up the frustrations dealing with
time (zones) in his Computerphile video:

[https://www.youtube.com/watch?v=-5wpm-
gesOY](https://www.youtube.com/watch?v=-5wpm-gesOY)

------
wyc
Not about C, but IMO the way that Go handles time is very convenient. Time
zones are pretty well-encapsulated in the Time struct and that makes for
really nice function interfaces. Also, there's this gem:

` These three considerations—choose an epoch as early as possible, that uses a
year equal to 1 mod 400, and that is no more than 2^63 seconds earlier than
1970—bring us to the year -292277022399. We refer to this year as the absolute
zero year, and to times measured as a uint64 seconds since this year as
absolute times. `

[https://golang.org/src/pkg/time/time.go](https://golang.org/src/pkg/time/time.go)

~~~
stormbrew
I like the higher resolution of Windows' FILETIME epoch better (microseconds
since 1601, positive and negative, or about 30000 years in each direction).
I'd rather have the resolution than be able to reference years the universe
didn't even exist in and only be able to do it in seconds.

~~~
bodyfour
It's actually 100ns granularity, not 1µs

~~~
stormbrew
Yep, absolutely right. I stand corrected.

------
DonHopkins
Summary of article: It's about fucking <time.h>!

------
lysium
So, is this still a draft?

------
user_id3
haha, no.

