Windows Time Information

Is there a way to get Time Zone information from kernel mode? I see functions like KeQuerySystemTime that give me system time as number of seconds (in 100ns units) since 1601.

No, nothing in km. Why?

d

Bent from my Phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?7/?5/?2013 4:52 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Windows Time Information

Is there a way to get Time Zone information from kernel mode? I see functions like KeQuerySystemTime that give me system time as number of seconds (in 100ns units) since 1601.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

ExSystemTimeToLocalTime will give you the time zone bias from GMT which can
with a calculation give you close to what you want.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, July 05, 2013 4:52 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Windows Time Information

Is there a way to get Time Zone information from kernel mode? I see
functions like KeQuerySystemTime that give me system time as number of
seconds (in 100ns units) since 1601.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Thanks Don. That sort of works…but what I really want is the Time Zone bias. I need this for a driver that is interacting with a hardware clock. The windows time service interacts with the drive. I guess I could just get the information from user mode, and pass it to the driver…

You can calculate the time zone bias, that is what Microsoft does to the
system time to get the local time.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, July 05, 2013 6:17 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Windows Time Information

Thanks Don. That sort of works…but what I really want is the Time Zone
bias. I need this for a driver that is interacting with a hardware clock.
The windows time service interacts with the drive. I guess I could just get
the information from user mode, and pass it to the driver…


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Getting it from um is best. You can also be notified of time changes in um as well

d

Bent from my Phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?7/?5/?2013 6:21 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Windows Time Information

Thanks Don. That sort of works…but what I really want is the Time Zone bias. I need this for a driver that is interacting with a hardware clock. The windows time service interacts with the drive. I guess I could just get the information from user mode, and pass it to the driver…


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Is it your own hardware clock? Why don’t you just use GMT in it? What’t the point of having a kernel component to use local time?

So yes it is our own hardware Alex. However, we generate output time from the hardware. Thus, if no INPUT time is being provided from a hardware source, we use Windows time. This is why I need the time zone information from Windows.

But why do you need the time zoe offset? aif you are proframming your
device to UCT then you don’t need to know tge offset. If you use the
conversion routine to get local time, then you don’t care about te offset.

joe

So yes it is our own hardware Alex. However, we generate output time from
the hardware. Thus, if no INPUT time is being provided from a hardware
source, we use Windows time. This is why I need the time zone information
from Windows.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

What Joe said. Why not use UCT (GMT) in the hardware, and if the hardware doesn’t provide it, use kernel’s UCT? Then all clients (user mode and/or remote) can convert to the local time for display purposes.

If you want uniform time, UCT is the way to go.

you can use this function. It works fine

unsigned long get_local_time(TIME_FIELDS *system_time)
{

LARGE_INTEGER CurrentTime; // contains time in GMT
LARGE_INTEGER LocalTime; // contain time Local machine time

// Get the GMT . System time is a count of 100-nanosecond intervals
since January 1, 1601
//KeQuerySystemTime and NdisGetCurrentSystemTime are same
NdisGetCurrentSystemTime(&CurrentTime);

// converts a GMT system time value to the local system time for the
current time zone.
ExSystemTimeToLocalTime(&CurrentTime, &LocalTime);

// The RtlTimeToTimeFields routine converts system time into a
TIME_FIELDS structure.
RtlTimeToTimeFields(&LocalTime, system_time);

return STATUS_SUCCESS;
}

On Sun, Jul 7, 2013 at 8:28 AM, wrote:

> What Joe said. Why not use UCT (GMT) in the hardware, and if the hardware
> doesn’t provide it, use kernel’s UCT? Then all clients (user mode and/or
> remote) can convert to the local time for display purposes.
>
> If you want uniform time, UCT is the way to go.
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>