views:

377

answers:

2

I am writing a C# windows service that is doing some churning through the eventlog on a few domain controllers. Some of them are Windows Server 2003 and some are Windows Server 2008. Upon the service stopping I am attempting to resume where I left off in the logs. In order to do this instead of

SELECT * FROM Win32_NTLogEvent WHERE --criteria for events I am looking for

I am doing

SELECT * FROM Win32_NTLogEvent WHERE TimeGenerated = --some date AND --criteria for events I am looking for

At one point I was convinced that the TimeGenerated field was in the local time of the server but now it seems that the Windows 2008 Servers are using GMT to record that time. Can anyone shed some light on if this is a real different between the way the two operating systems function or is this a configuration problem?

A: 

Windows time stamps are always recorded in UTC. They will only be converted to local time in whatever GUI program you use to look at the data, like Event Viewer or Explorer (for file times). This behavior is important to avoid random failure on daylight saving time transitions.

Hans Passant
A: 

In addition, it seems that in versions prior to Windows Server 2008 TimeGenerated was returned in local time, but changed to GMT in Server 2008, as others have been noticing.

Garett
I had seen the above links before I had posted the question and they had me looking for a problem that doesn't seem to be there. I just queried my 2003 server and it returned GMT just like my 2008 server. I'm not saying that it never returned local time but my 2003 sp2 server is currently returning GMT. Thanks for your answers, but turns out I had a different issue that I was chasing.
jpmcclung