JavaScript EditorDhtml editor     Free javascript download 

Main Page

The following code example demonstrates how to determine the tick count, or number of milliseconds that have elapsed since Windows was started. This value is stored in the System.Environment.TickCount member and, because it is a 32-bit value, resets to zero approximately every 24.9 days.


В CopyCode imageCopy Code
// startup_time.cpp
// compile with: /clr
using namespace System;

int main( ) 
   Int32 tc = Environment::TickCount;
   Int32 seconds = tc / 1000;
   Int32 minutes = seconds / 60;
   float hours = static_cast<float>(minutes) / 60;
   float days = hours / 24;

   Console::WriteLine("Milliseconds since startup: {0}", tc);
   Console::WriteLine("Seconds since startup: {0}", seconds);
   Console::WriteLine("Minutes since startup: {0}", minutes);
   Console::WriteLine("Hours since startup: {0}", hours);
   Console::WriteLine("Days since startup: {0}", days);

   return 0;

See Also

JavaScript EditorDhtml editor     Free javascript download