Current Time and Date

Hi,

In a WDM driver, how can I determine the current local time?
KeQuerySystemTime() returns the time in the GMT time zone. The MSDN
docs suggest to use ExSystemTimeToLocalTime for converting it, but that
requires including ntddk.h, which is not accessible by WDM drivers.

The distinction between WDM and NT drivers is non existent, just #include ntddk.h

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Tuesday, May 04, 2010 10:59 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Current Time and Date

Hi,

In a WDM driver, how can I determine the current local time?
KeQuerySystemTime() returns the time in the GMT time zone. The MSDN docs suggest to use ExSystemTimeToLocalTime for converting it, but that requires including ntddk.h, which is not accessible by WDM drivers.


NTDEV is sponsored by OSR

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

xxxxx@hotmail.com wrote:

In a WDM driver, how can I determine the current local time?
KeQuerySystemTime() returns the time in the GMT time zone. The MSDN
docs suggest to use ExSystemTimeToLocalTime for converting it, but that
requires including ntddk.h, which is not accessible by WDM drivers.

Unless you need to target Win 98, there is no longer any need to limit
yourself to the strict WDM subset. Just use <ntddk.h>.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.</ntddk.h>

> In a WDM driver, how can I determine the current local time?

Always use only GMT time in the driver. Do the GMT->local conversion only in user mode tools.

Very often the things can be done this way.

requires including ntddk.h, which is not accessible by WDM drivers.

It is accessible. Win9x is dead, so, WDM drivers can use ntddk.h instead of wdm.h

wdm.h was only used for Win9x compatibility.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com