abbotti at mev.co.uk
Fri Jul 1 10:54:47 UTC 2011
On 01/07/11 11:35, Guy Harris wrote:
> On Jun 30, 2011, at 6:15 AM, Kevin Kenny wrote:
>> And it has been used - from the very earliest
>> days - as a calculation device for the civil clock. I would venture
>> the guess that virtually all programs that depend on "seconds from
>> 1 January 1970" actually are doing things like computing days between
>> two times:"
> If you phrase that as "time intervals between two times", I might agree. If you restrict it to "days", I wouldn't; many of them calculate seconds.
>> (time1/86400 - time2/86400).
> ...a calculation that could report 0 days between two events happening on different days, if fewer than 86400 seconds elapse between them, and you're doing it as an integer division.
> 2011-06-29 22:00:00 (US Pacific time) is 1309410000; 2011-06-30 11:00:00 (US Pacific time) is 1309456800. 1309410000/86400 is 15155, as is 1309456800/86400.
But presumably it works fine for day boundaries in the UTC timezone with
times in seconds since the POSIX epoch (ignoring leap seconds etc.).
Presumably it works for other timezones if you add the appropriate
offset(s) to time1 and time2 (the offsets added to time1 and time2 would
be the same unless there have been DST or other changes in the meantime).
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti at mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
More information about the tz