www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Local time(Windows2000)

The time zone of my area is +09:00.
However, it will be get to 0.

d_time t = getUTCtime();
assert(UTCtoLocalTime(t) != t);	// failuer

The return value of GetTimeZoneInformation is TIME_ZONE_ID_STANDARD, In the case
of Windows9x.
But, in the case of WindowsNT/2000, it is TIME_ZONE_ID_UNKNOWN.
However, std.date.getLocalTZA is not taking TIME_ZONE_ID_UNKNOWN into
consideration.
So, in Windows2000, a time zone cannot get correctly.

Probably, should change std.date.getLocalTZA as follows?:

r = GetTimeZoneInformation(&tzi);
if(r != TIME_ZONE_ID_INVALID){
int bias = tzi.Bias;
if(ret == TIME_ZONE_ID_STANDARD || ret == TIME_ZONE_ID_DAYLIGHT)
bias += tzi.StandardBias;
t = -bias * cast(d_time)(60 * TicksPerSecond);
}else{
t = 0;
}
Sep 03 2004