representation of the amount of time the computer has been on since the OS started.
public string getUptime()
{
String strResult = String.Empty;
strResult += Convert.ToString(Environment.TickCount / 86400000) + " days, ";
strResult += Convert.ToString(Environment.TickCount / 3600000 % 24) + " hours, ";
strResult += Convert.ToString(Environment.TickCount / 120000 % 60) + " minutes, ";
strResult += Convert.ToString(Environment.TickCount / 1000 % 60) + " seconds.";
return strResult;
}
منبع : http://www.dreamincode.net/code/snippet1555.htm