Hacker News new | ask | show | jobs
by jesprenj 1305 days ago
Edit: My original comment is incorrect. Please read child comments.

Original comment:

Yes, to convert from UNIX time to UTC, you do need a list of leap seconds.

2 comments

Others have already corrected you, but in case it makes it more concrete, here is the implementation of timegm() in musl (the libc used in Alpine Linux and some other Linux distributions). timegm() takes a time in UTC and converts it to Unix time.

http://git.musl-libc.org/cgit/musl/tree/src/time/timegm.c

http://git.musl-libc.org/cgit/musl/tree/src/time/__tm_to_sec...

You'll notice there is no handling or knowledge of leap seconds. (Leap years are handled, of course.)

No. You need a list of leap seconds to convert from Unix time to TAI.