Discussion:
query datetime problem
(too old to reply)
pantagruel
2009-05-10 10:29:52 UTC
Permalink
Hi,

I am starting a process that along with a number of other processes
writes to a custom event log. This process executes periodically a
task.

At the time of task starting I register a time, and when the task is
finished I want to get all the entries to the custom log executed
during the task.

The query I was using was the following:

String WMIQuery = "SELECT * FROM Win32_NTLogEvent WHERE Logfile =
'RenderingServices' AND TimeWritten >= '" + convertdate + "'";

The datetime when my task started was
20090510110129.5000000+0200

the datetime when my task ended was at

20090510110132.6718750+0200

during that time there were a number of entries written to the event
log but one thing I am noticing when I look at it is that the events
which I know are written after the task was started nonetheless every
event that is written is at time 20090510110132.000000+12.

So the question is - any way to do the query in a different way to get
all messages written after the starting time? Any way to set the
correct time when writing event log entries (using .NET in most of the
applications)

Thanks,
Bryan Rasmussen
pantagruel
2009-05-10 13:42:46 UTC
Permalink
Another rather irritating aspect of this is that the query:
String WMIQuery = "SELECT * FROM Win32_NTLogEvent WHERE Logfile =
'RenderingServices' AND TimeWritten > '" + convertdate + "'";
doesn't return any data, whereas this query

String WMIQuery = "SELECT * FROM Win32_NTLogEvent WHERE Logfile =
'RenderingServices' AND TimeCreated > '" + convertdate + "'";
raises an error, I guess TimeCreated in .NET System.Management has
become TimeGenerated or something, but if I try it with TimeGenerated
it still fails.

Best Regards,
Bryan Rasmussen





I'm using System.Management
Post by pantagruel
Hi,
I am starting a process that along with a number of other processes
writes to a custom event log. This process executes periodically a
task.
At the time of task starting I register a time, and when the task is
finished I want to get all the entries to the custom log executed
during the task.
String WMIQuery = "SELECT * FROM Win32_NTLogEvent WHERE Logfile =
'RenderingServices' AND TimeWritten >= '" + convertdate + "'";
The datetime when my task started was
20090510110129.5000000+0200
the datetime when my task ended was at
20090510110132.6718750+0200
during that time there were a number of entries written to the event
log but one thing I am noticing when I look at it is that the events
which I know are written after the task was started nonetheless every
event that is written is at time  20090510110132.000000+12.
So the question is - any way to do the query in a different way to get
all messages written after the starting time? Any way to set the
correct time when writing event log entries (using .NET in most of the
applications)
Thanks,
Bryan Rasmussen
Loading...