I know Environment.TickCount exist but I have a big problem with that, it's limited to 25 days.
what would be a good alternative that require no external module/dll and would work in a vanilla install of windows server 2003?
thanks
I know Environment.TickCount exist but I have a big problem with that, it's limited to 25 days.
what would be a good alternative that require no external module/dll and would work in a vanilla install of windows server 2003?
thanks
Plenty of choices.
public TimeSpan SystemUpTime()
{
PerformanceCounter upTime =
new PerformanceCounter("System", "System Up Time");
// You've got to call this twice. First time it returns 0
// and the second time it returns the real info.
upTime.NextValue();
return TimeSpan.FromSeconds(upTime.NextValue());
}
This, however, won't run if you don't have sufficient privileges.
You can also use WMI