Re: Predictable Internet Time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4 Jan 2017, at 0:14, Tony Finch wrote:

>>> $ perl -MPOSIX -e 'print strftime "%F %T\n", gmtime 1483228799'
>>> 2016-12-31 23:59:59
>>> $ perl -MPOSIX -e 'print strftime "%F %T\n", gmtime 1483228800'
>>> 2017-01-01 00:00:00
>
> I'm not sure what you mean. If you add (24+24+23)*3600 seconds to 1483228800 you get 23:00:00 today, which is the same length of time after 2017-01-01 00:00:00. Nothing is one second behind now. Except it has taken me more than 600 seconds to write this message.

Well, if you look at the POSIX definition you see that it is clearly wrong the days when leap second is added:

tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
    (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
    ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400


2015-12-31 23:59:58 365th day 61409923198
2015-12-31 23:59:59 365th	 day 61409923199
2016-01-01 00:00:00   1st day 61409836800
2016-01-01 00:00:01   1st day 61409836801
									
2016-12-31 23:59:59 366th day 61441459199
2016-12-31 23:59:60 366th day 61441459200
2017-01-01 00:00:00   1st day 61441459200
2017-01-01 00:00:01   1st day 61441459201

I.e. the real problem we have is a broken POSIX definition.

    Patrik

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [IETF Annoucements]     [IETF]     [IP Storage]     [Yosemite News]     [Linux SCTP]     [Linux Newbies]     [Fedora Users]