std.date

Kagamin spam at here.lot
Wed Nov 17 12:37:18 PST 2010


Jonathan M Davis Wrote:

> > This is how it looked on linux:
> > 
> > bash-2.05b# date
> > Thu Jan 1 00:59:58 CET 2009
> > bash-2.05b# date
> > Thu Jan 1 00:59:59 CET 2009
> > bash-2.05b# date
> > Thu Jan 1 00:59:60 CET 2009
> > bash-2.05b# date
> > Thu Jan 1 01:00:00 CET 2009
> > bash-2.05b# date
> > Thu Jan 1 01:00:01 CET 2009
> > bash-2.05b#
> 
> That's the standard, but supposedly it varies a bit in how it's handled - at 
> least if you read it up on Wikipedia.
> 
> I'd have to go digging in std.datetime again to see exactly what would happen on 
> a leap second, but IIRC you end up with either 59 twice or 00 twice.

An exception will be thrown, this is tested:

assertExcThrown!(DateTimeException, (){TimeOfDay(0, 0, 0).second = 60;})(LineInfo());

> and in 99.9999999999% of situations, if you 
> have a 60th second, it's a programming error, so TimeOfDay considers 60 to be 
> outside of its range and throws if you try and set its second to 60.

That's probably why Oracle and Solaris rebooted on 2009-01-01.


More information about the Digitalmars-d mailing list