Time since the epoch

George Russell ger@tzi.de
Wed, 12 Feb 2003 18:07:50 +0100


Jonathan Coxhead wrote (quoting me, snipped)
>> Add 1 minute to 23:59:60 31st December 2003.  I assume that this is a valid 
> time
>> and that it will be a leap second; if not choose some other year.
>> 
>> This is complicated since we have multiple overflows.  First stage you get the
>> invalid time
>> 
>> 23:60:60 31st December 2003.
> 
>    But **HERE**, you add 60 seconds. Why? If you want to add "1 minute" to 
> 23:59:60 31st December 2003, and assuming still that it is a leap minute, then 
> to be consistent with the rule for months, I think you ought to add **61** 
> seconds---the number of seconds in *this* minute.
> 
>    If the problem had been to add "60 seconds", I would agree, but if the 
> problem is to add "1 minute", I think there's a flaw here.

Your arithmetic is faulty.  Because we are assuming 23:59:60 31st December 2003
is a leap second, there are 61 seconds until 00:01:00 1st January 2004, the time
my method (eventually) produces.