Implement NtQuerySystemInformation(SystemTimeOfDayInformation)

Rein Klazes wijn at wanadoo.nl
Thu May 19 00:39:43 CDT 2005


On Wed, 18 May 2005 21:15:05 +0200, you wrote:

> Rein Klazes wrote:
> > On Tue, 17 May 2005 23:06:51 +0200, you wrote:
> >>+                RtlSystemTimeToLocalTime(&sys_time, &local_time);
> >>+                /* liExpTimeZoneBias is not the same as tzi.Bias since it takes
> >>+                 * disabled DST correction into account (tested on WinXP). */
> >>+                local_diff.QuadPart = sys_time.QuadPart - local_time.QuadPart;
> > You mean the "Automatically adjust clock for daylight saving"? Wine does
> 
> Yep.
> 
> > not follow this silly flag and at a couple of places it depends on it. I
> > doubt whether it should.
> 
> By the way, how is this flag set?

It is a value "DisableAutoDaylightTimeSet" in the registry key with the
other timezone info. The overall effect seems to be to "use the timezone
but ignore all daylight" settings. That would not make sense on a Unix
system that is using a timezone with daylight switching in operation. I
tend to think wine should not support this flag.  

Reading the comment again, I think you are mistaken: the "actual" bias
is not tzi.Bias but either tzi.Bias + tzi.StandardBias or tzi.Bias +
tzi.DaylightBias. If the flag is set, tzi.DaylightBias is zero, that is
how the "actual" bias takes the disabled DST correction into account.

> 
> >>+
> >>+                sti->liKeBootTime       = NTDLL_BootTime;
> >>+                sti->liKeSystemTime     = sys_time;
> >>+                sti->liExpTimeZoneBias  = local_diff;
> >>+                sti->uCurrentTimeZoneId = RtlQueryTimeZoneInformation(&tzi);
> > This does not look correct. AFAIK RtlQueryTimeZoneInformation returns an
> > NT-status code, 0 is no success, otherwise it is an error code. Have a
> 
> Oops, right.
> 
> > look at GetTimeZoneInformation how to compute a TimeZoneId.
> 
> Well, I could just duplicate the code but wouldn't it make more sense to 
>   move this code from kernel32 to ntdll and let GetTimeZoneInformation() 
> call NtQuerySystemInformation()?

That is a possibility. But some code must be duplicated still for the
support of TzSpecificLocalTime kernel32 API's, unless you know NT
equivalents.

> 
> I dunno if this is how it's done on Windows (some of this information, 
> like liExpTimeZoneBias for example, is stored in UserSharedData as an 
> example program on MSDN shows) but I guess it would be more more correct?

Yes.

Rein.



More information about the wine-devel mailing list