Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will `gmtime()` report seconds as 60 when in a leap second?

Tags:

I have a server running in TZ=UTC and I have code like this:

time_t t = time(NULL);
struct tm tm;
gmtime_r(&t, &tm);

The question is will tm.tm_sec == 60 when the server is within a leap second?

For example, if I were in the following time span:

1998-12-31T23:59:60.00 - 915 148 800.00
1998-12-31T23:59:60.25 - 915 148 800.25
1998-12-31T23:59:60.50 - 915 148 800.50
1998-12-31T23:59:60.75 - 915 148 800.75
1999-01-01T00:00:00.00 - 915 148 800.00

would gmtime() return tm == 1998-12-31T23:59:60 for time_t = 915148800 and, once out of the leap second, return tm == 1999-01-01T00:00:00 for the same time_t?