Connecting Tech Pros Worldwide Forums | Help | Site Map

How to Get Server Reboot Time?

samtilden@gmail.com
Guest
 
Posts: n/a
#1: May 31 '06
I am writing in C# .NET and am using System.Environment.TickCount
(32-bit integer) to get the number of milliseconds since the server was
rebooted.

The problem is that the server has been up for over 30 days and the
32-bit integer is coming back negative. Of course, I can extend it
with zeros and make it a 64-bit integer, but what will happen after 60
days or so?

Will the C# code then loop around through zero and start reporting a
low number of milliseconds?

Or, better yet, was it a sure-fire way to find out when the server was
rebooted?

(I can use WMI if necessary).


Greg Young
Guest
 
Posts: n/a
#2: May 31 '06

re: How to Get Server Reboot Time?


http://www.codeproject.com/aspnet/we...select=1114596
includes an example using WMI

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
<samtilden@gmail.com> wrote in message
news:1149109790.207986.75680@c74g2000cwc.googlegro ups.com...[color=blue]
>I am writing in C# .NET and am using System.Environment.TickCount
> (32-bit integer) to get the number of milliseconds since the server was
> rebooted.
>
> The problem is that the server has been up for over 30 days and the
> 32-bit integer is coming back negative. Of course, I can extend it
> with zeros and make it a 64-bit integer, but what will happen after 60
> days or so?
>
> Will the C# code then loop around through zero and start reporting a
> low number of milliseconds?
>
> Or, better yet, was it a sure-fire way to find out when the server was
> rebooted?
>
> (I can use WMI if necessary).
>[/color]


Closed Thread