How to determine current time zone offset and DST flag from kernel mode?

Basically, I want to know what the current time zone offset from GMT is
and if we’re currently in Daylight Savings Time or not. This is so I
can program an attached device, not for our own purposes. So, just
converting to local time does no good. And RtlLocalTimeToTimeFields
also doesn’t help since it doesn’t give the time zone information. I
tried a simple subtraction of the local time from the system time, but
then I don’t know if I’m in DST or not.

I see that it’s in the Registry, but I’d rather not do that.

It seems that there should be some easy way to do this, or maybe this is
just one of those things that can’t be done from kernel mode?

ExSystemTimeToLocalTime


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Taed Wynnell
Sent: Wednesday, April 05, 2006 2:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to determine current time zone offset and DST flag
from kernel mode?

Basically, I want to know what the current time zone offset from GMT is
and if we’re currently in Daylight Savings Time or not. This is so I
can program an attached device, not for our own purposes. So, just
converting to local time does no good. And RtlLocalTimeToTimeFields
also doesn’t help since it doesn’t give the time zone information. I
tried a simple subtraction of the local time from the system time, but
then I don’t know if I’m in DST or not.

I see that it’s in the Registry, but I’d rather not do that.

It seems that there should be some easy way to do this, or maybe this is
just one of those things that can’t be done from kernel mode?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Could this be done from the app which talks to the attached device?

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Taed Wynnell
Sent: Wednesday, April 05, 2006 11:23 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to determine current time zone offset and DST flag
from kernel mode?

Basically, I want to know what the current time zone offset from GMT is
and if we’re currently in Daylight Savings Time or not. This is so I
can program an attached device, not for our own purposes. So, just
converting to local time does no good. And RtlLocalTimeToTimeFields
also doesn’t help since it doesn’t give the time zone information. I
tried a simple subtraction of the local time from the system time, but
then I don’t know if I’m in DST or not.

I see that it’s in the Registry, but I’d rather not do that.

It seems that there should be some easy way to do this, or maybe this is
just one of those things that can’t be done from kernel mode?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

As I mentioned, just subtracting those values gives you only the current
offset including the DST. I need to know the base GMT offset and whether
it’s in a DST cycle or not. For example, currently in California, I think
the values should be -8 and TRUE, which works out to be an overall offset
of -7.

“Roddy, Mark” wrote in message news:xxxxx@ntdev…
ExSystemTimeToLocalTime

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Taed Wynnell
Sent: Wednesday, April 05, 2006 2:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to determine current time zone offset and DST flag
from kernel mode?

Basically, I want to know what the current time zone offset from GMT is
and if we’re currently in Daylight Savings Time or not. This is so I
can program an attached device, not for our own purposes. So, just
converting to local time does no good. And RtlLocalTimeToTimeFields
also doesn’t help since it doesn’t give the time zone information. I
tried a simple subtraction of the local time from the system time, but
then I don’t know if I’m in DST or not.

I see that it’s in the Registry, but I’d rather not do that.

It seems that there should be some easy way to do this, or maybe this is
just one of those things that can’t be done from kernel mode?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Use ZwQuerySystemInformation with SystemTimeZoneInformation see
vig.pearsonptr.com:8081/samplechapter/1578701996.pdf


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Taed Wynnell” wrote in message news:xxxxx@ntdev…
> As I mentioned, just subtracting those values gives you only the current
> offset including the DST. I need to know the base GMT offset and whether
> it’s in a DST cycle or not. For example, currently in California, I think
> the values should be -8 and TRUE, which works out to be an overall offset
> of -7.
>
> “Roddy, Mark” wrote in message
> news:xxxxx@ntdev…
> ExSystemTimeToLocalTime
>
> ________________________________
>
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Taed Wynnell
> Sent: Wednesday, April 05, 2006 2:23 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to determine current time zone offset and DST flag
> from kernel mode?
>
>
>
> Basically, I want to know what the current time zone offset from GMT is
> and if we’re currently in Daylight Savings Time or not. This is so I
> can program an attached device, not for our own purposes. So, just
> converting to local time does no good. And RtlLocalTimeToTimeFields
> also doesn’t help since it doesn’t give the time zone information. I
> tried a simple subtraction of the local time from the system time, but
> then I don’t know if I’m in DST or not.
>
> I see that it’s in the Registry, but I’d rather not do that.
>
> It seems that there should be some easy way to do this, or maybe this is
> just one of those things that can’t be done from kernel mode?
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
>
>

Don, may I remind you that this system call as well as the structures it
uses are NOT DOCUMENTED by Microsoft and the information you provide has
likely been obtained through experimenting and reverse engineering. They are
not guaranteed to be compatible with future operating systems or service
packs and may break at any point in time. Although there is some information
on the Microsoft site about NtQuerySystemInformation, its sole purpose is to
generate an unpredictable seed for a random number generator. I know of
companies who would trash your product if they’d know you’d make use of such
techniques.

/Daniel

“Don Burn” wrote in message news:xxxxx@ntdev…
> Use ZwQuerySystemInformation with SystemTimeZoneInformation see
> vig.pearsonptr.com:8081/samplechapter/1578701996.pdf
>
>
> –
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
> “Taed Wynnell” wrote in message news:xxxxx@ntdev…
>> As I mentioned, just subtracting those values gives you only the current
>> offset including the DST. I need to know the base GMT offset and whether
>> it’s in a DST cycle or not. For example, currently in California, I
>> think
>> the values should be -8 and TRUE, which works out to be an overall offset
>> of -7.
>>
>> “Roddy, Mark” wrote in message
>> news:xxxxx@ntdev…
>> ExSystemTimeToLocalTime
>>
>> ________________________________
>>
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Taed Wynnell
>> Sent: Wednesday, April 05, 2006 2:23 PM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] How to determine current time zone offset and DST flag
>> from kernel mode?
>>
>>
>>
>> Basically, I want to know what the current time zone offset from GMT is
>> and if we’re currently in Daylight Savings Time or not. This is so I
>> can program an attached device, not for our own purposes. So, just
>> converting to local time does no good. And RtlLocalTimeToTimeFields
>> also doesn’t help since it doesn’t give the time zone information. I
>> tried a simple subtraction of the local time from the system time, but
>> then I don’t know if I’m in DST or not.
>>
>> I see that it’s in the Registry, but I’d rather not do that.
>>
>> It seems that there should be some easy way to do this, or maybe this is
>> just one of those things that can’t be done from kernel mode?
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>>
>>
>
>
>