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
Example
| В | Copy 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;
} | |
Dhtml editor
Free javascript download