deep Messages: 268 Registered: July 2011 Location: Bangalore
Experienced Member
Actually milliseconds is part of
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
ManfredHerr Messages: 67 Registered: February 2013 Location: Germany
Member
1. This is a windows solution only
2. Some say that the resolution is poor, i.e. 66msecs interval the same time stamp.
If you need better resolution and portability please consider Didier's offering in the forum:
high resolution TimeStop code [message #44393]
Mindtraveller Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
Experienced Contributor
As long as U++ moves to C++11, you may try something like
#include <chrono>
using namespace std::chrono;
int main() {
auto now = system_clock::now();
time_point<system_clock> epoch;
microseconds ms = duration_cast<milliseconds>(now - epoch);
microseconds hs = std::chrono::hours(1);
}