Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Time issues

Moderators: kris

Posted: 12/28/07 17:35:08

You can get the ticks for a point in time (Time), but you can not construct it back from the ticks, so in order to remember a moment you have to construct a TimeSpan?... Or some other ugly solution...

thanks, bobef

Author Message

Posted: 12/28/07 19:04:31

text.convert.TimeSpan?.iso8601 has bug in this line:

date.ms = parseInt (p);

there is no ms member for Date.

Posted: 12/29/07 05:32:45 -- Modified: 12/29/07 05:33:08 by
kris

You can create Time or TimeSpan instances using standard D syntax. For example:

auto t = Time(10);
auto s = TimeSpan(20);

Thus, you should be able to construct a Time from a ticks value, as necessary

Posted: 12/29/07 05:33:50

bobef wrote:

text.convert.TimeSpan.iso8601 has bug in this line:

date.ms = parseInt (p);

there is no ms member for Date.

fixed. Thanks!

Posted: 12/29/07 09:29:04

kris wrote:

You can create Time or TimeSpan instances using standard D syntax. For example:

auto t = Time(10);
auto s = TimeSpan(20);

Thus, you should be able to construct a Time from a ticks value, as necessary

I must have missed something. At least I'm pretty sure it is not in the docs (opCall I mean).

Posted: 01/30/08 20:30:25

I know this is a little late, but...

opCall does not exist for Time and TimeSpan?. By doing Time(10) or TimeSpan?(20), you are using D's built-in ability to construct a struct by giving the values for its members. Because Time and TimeSpan? have a single 'ticks' member, this works.

I suppose this should be better documented, as the internal representation is supposed to be abstract.