C
C
CommonX2021-12-23 02:17:34
C++ / C#
CommonX, 2021-12-23 02:17:34

How to get GMT+3 time in milliseconds?

You need to get the current Moscow time in milliseconds since 1970 (without loss in milliseconds)
Windows
I tried various options, but I didn’t find a solution to my question, in my head there was only an option to get the local time of the computer and gmtime time from which to calculate the number of milliseconds from loss of ~1000ms., but returning the difference when compared with local time

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-12-23
@rPman

#include <chrono>
...
using namespace std::chrono;

milliseconds ms = duration_cast< milliseconds >(
    system_clock::now().time_since_epoch()
);
unsigned __int64 count=ms.count();

convert to the desired timezone to_local or simply by adding (or subtracting?) a pre-calculated number of milliseconds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question