Type for Current Time Function

Bayley, Alistair Alistair_Bayley at ldn.invesco.com
Fri Feb 4 10:52:38 EST 2005


> From: Simon Marlow [mailto:simonmar at microsoft.com] 
> 
> I think I don't really understand the (days,ticks) representation.
> Could somebody explain the meaning of arithmetic on this type?  
> 
> Is the ticks field supposed to be limited to a day's worth?  
> Or a day + a leap second?


I'm assuming that it's UTC (i.e. ticks = day plus optional leap second),
although others might think differently...


> Can I add ticks to a time?  If so, don't you need leap second 
> info to do
> the normalisation?  Or, if normalisation doesn't happen, you need leap
> second info to convert to UTC, right?  The only conclusion seems to be
> that either you can't add ticks to a time, or you need leap 
> second info
> which is what we're trying to avoid.

Isn't this a general problem, rather than a specific representation problem?
The only representation where you wouldn't have to know about leap seconds
would be TAI.

E.g. there was a leap second on 1997-06-30 23:59:60 UTC, so:

 - Q: how many seconds are there between 1997-06-30 00:00:00 UTC and
1997-07-01 00:00:00 UTC ?
   A: 86401

 - Q: how many days are there between 1997-06-30 00:00:00 UTC and 1997-07-01
00:00:00 UTC ?
   A: 1

 - Q: how long is the period between 1997-06-30 00:00:00 UTC and 1997-07-01
00:00:00 UTC ?
   A: 1 day 1 second, or 1 day ? (I guess just 1 day, as a day can be 86401
seconds long.)

 - Q: how many seconds in a day?
   A: 86400 (or maybe this is undefined, as it could be 86399, 86400,
86401?)

 - Q: what is 1997-06-30 00:00:00 UTC plus one day?
   A: 1997-07-01 00:00:00 UTC

 - Q: what is 1997-06-30 00:00:00 UTC plus 86400 seconds?
   A: 1997-06-30 23:59:60 UTC


It gets hairy when you start thinking about durations, and I would like to
see duration arithmetic in the library. I don't have any good ideas about
how to handle this.


Alistair.

-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this   message, and any
attachments, may contain confidential   and/or privileged material. It is
intended solely for the   person(s) or entity to which it is addressed. Any
review,   retransmission, dissemination, or taking of any action in
reliance upon this information by persons or entities other   than the
intended recipient(s) is prohibited. If you received  this in error, please
contact the sender and delete the   material from any computer.
*****************************************************************



More information about the Libraries mailing list