[phobos] datetime review (new attempt at URL)

Jonathan M Davis jmdavisProg at gmx.com
Thu Oct 14 19:47:10 PDT 2010


On Thursday 14 October 2010 19:04:12 Steve Schveighoffer wrote:
> > > 2. I highly recommend ignoring the concept of leap-seconds, as it just 
> > > adds constant maintenance (since leap seconds cannot be predicted) and
> > >  doesn't add much to the library.  However, it should be noted 
> > > whether you support them.
> > 
> > PosixTimeZone will support them if you  use one of the time zones that
> > has them
> > 
> > (the ones starting with right/ I  believe), but that's it. Since, they
> > come
> >
> >from
> >
> > the tz files, no maintenance  is required. Whether LocalTime or UTC uses
> > leap seconds is completely  system-dependent, but I wouldn't expect them
> > to (and I know that they won't  on posix systems since posix ignores
> > leap seconds). So, truth be told, the  right/ time zones will act
> > differently if used with PosixTimeZone than if  you were to have your
> > system time using them.
> 
> What I mean was, if you subtract two points in time that cross a
> leap-second boundary, will you take into account the extra second?

SysTime keeps time in hnsecs from midnight, January 1st, 1 AD UTC without leap 
seconds. The various getters convert that to the appropriate time zone 
(including leap seconds if that time zone has them). So, converting between time 
zones is breeze. You just change the time zone object for the SysTime. No math
is necessary at all.

Now, as for the subtraction, the adjusted hnsecs would be used, so if one or 
both of them used a time zone with leap seconds, then the leap seconds would be 
accounted for.

As for the rest of your comments, I'll have to look at it in detail to see how 
best to apply them.

- Jonathan M Davis


More information about the phobos mailing list