I've used the code from one of the answers on this forum but it's doesn't appear to be correct. I don't know if it's the code or the way I'm logging it.
unsigned long long int NQCTestInstance::getCurrentTimeInMs() {
unsigned long milliseconds_since_epoch =
std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::system_clock::now().time_since_epoch()).count();
Log("Timestamp = %u\n\n", milliseconds_since_epoch);
return milliseconds_since_epoch;
}
The Log output is 119682234, which is only nine characters when it should be ten. Is this as simple as the %u in the Log statement being incorrect?
@Igor Tandetnik and @John Zwinck were on the right tracks.
I changed everything to unsigned long long
and then used %llu
(not %lu
) for the logging.