How to get current system at kernel?

While I’m working on NDIS filter driver development, and I have to obtain current system time. It is possible to include time.h in precomp.h but I cannot use time(), ctime() and other similar functions in my main functions since it will cause a link error:
error LNK2019: unresolved extern symbol __imp__localtime referenced in function _FilterSendNetBufferLists@16
Could anyone told me which functions are available here in kernel to obtain current system time? Or how can I solve this problem?
Thanks.

KeQuerySystemTime to ge the system time, ExSystemTimeToLocalTime to convert it to local time

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, April 15, 2010 10:02 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get current system at kernel?

While I’m working on NDIS filter driver development, and I have to obtain current system time. It is possible to include time.h in precomp.h but I cannot use time(), ctime() and other similar functions in my main functions since it will cause a link error:
error LNK2019: unresolved extern symbol __imp__localtime referenced in function _FilterSendNetBufferLists@16
Could anyone told me which functions are available here in kernel to obtain current system time? Or how can I solve this problem?
Thanks.


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

>possible to include time.h in precomp.h but I cannot use time(), ctime() and other similar functions

I think they are just absent in the kernel.

KeQuerySystemTime is one of the solutions.


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

Also note RtlTimeToTimeFields


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