Re: <time> values in HTML5

On Sat, 3 Dec 2011 15:18:40 -0500
John Cowan <cowan@mercury.ccil.org> wrote:

> Note that contrary to what XML Schema Part 2 says, the underlying
> value space of a duration is two-dimensional: months and seconds.  We
> need two because the number of seconds in a month depends on what
> month it is, whereas years can be reliably reduced to months, and
> days/hours/minutes can be reliably reduced to seconds (given that XML
> Schema does not permit talk of leap seconds).  XML Schema 1.1 gets
> this right.

In areas that observe daylight savings, some days are 3600 seconds
longer or shorter than usual. Not sure what the semantics of a duration
such as P1D are on a day when the clocks go forwards or back.

There are also leap seconds to contend with. Occasionally (just twice
this century so far) we have a 61 second minute to deal with the fact
that the rotation of the Earth is slowing. This always occurs just
before the midnight that marks the end of June or December.

And then there's oddities like the 30th of December 2011 which,
according to the government of Samoa, simply will not exist. The
Samoans will skip straight from the 29th to the 31st, taking themselves
over the International Date Line. (The majority of their business is
with Australia and New Zealand, and being on the other side of the date
line, they effectively lose 2 days of trading each week because they're
observations of weekends don't coincide. Thus the motivation for
skipping 30th December 2011 is primarily economic.)

The Perl DateTime::Duration module (which is pretty darn good) uses a
five-dimensional value space: months, days, minutes, seconds and
nanoseconds. The last two could theoretically be merged, but DateTime
keeps them separate to take advantage of integer arithmetic. The other
distinctions are necessary for datetime calculations.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Sunday, 4 December 2011 08:27:48 UTC