On Mon, 21 Nov 2005, Rick Measham wrote:

mathieu longtin wrote:
Cause time since the epoch doesn't measure leap seconds. See in the
DateTime manual, under the epoch() method description.

I'm aware that it doesn't measure them ... but I'm wondering why? Surely that makes it Capital-W-Wrong. Perl will return the Wrong number of elapsed seconds since 1970 ...

I started writing up an explanation but then realized I was too confused. I suggest reading these links:

http://en.wikipedia.org/wiki/Unix_epoch
http://cr.yp.to/proto/utctai.html

That'll clear everything up. The upshot is that the epoch is just a number, but the formula for translating it into a datetime just works, except _during_ a leap second, when it gives you an answer that is one second off.

What it doesn't work for is addition and subtraction, if you're expecting UTC results. Instead you get TAI results.

So which is stupider, leap seconds or POSIX?  Hard to say ;)


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to