std.date time problem
Regan Heath
regan at netmail.co.nz
Wed Aug 22 02:22:23 PDT 2007
Stewart Gordon wrote:
> Regan Heath Wrote:
>
>> I think this is a bug, but I can't be sure.
>
> Yes, in your code.
>
> <snip>
>> d_time now = UTCtoLocalTime(getUTCtime()); writefln("%s",
>> toTimeString(now));
> <snip>
>
> http://www.digitalmars.com/d/archives/digitalmars/D/learn/3205.html
>
> "It isn't documented but the input to toTimeString() is assumed to be
> UTC, and it outputs a Local time string."
Ahhh. Ick. That's a bit counter-intuitive no?
I'd prefer timezone conversions to be restricted to the explicit calls
UTCtoLocalTime and LocalTimetoUTC.
I'd also like to be able to convert from d_time to Date and back again
without having to go:
d_time -> char[] -> parse -> Date
In other words, unless I'm mistaken, currently the only way to get a
Date is from a string/char[].
What's wrong with the model used by ANSI C? time, localtime, gmtime,
asctime, mktime, etc.
Regan
p.s. One really annoying bug I discovered some years ago was that the M$
time library and the borland one were incompatible, one applied timezone
changes in time (and presumably reversed it in gmtime), the other in
localtime. It manifested when linking a program compiled in one linking
to a dll compiled in the other. Ick.
More information about the Digitalmars-d
mailing list