Previously I had a question about __DATE__
I want to use __DATE__ to get the build time.
The product will be compiled on systems with different locale.
Is the format for __DATE__ always the same?
My goal is to get the buildtime from __DATE__ and i want to make sure it works on any system.
Currently I use:
QDateTime(QLocale("en_US").toDate(QString(__DATE__).simplified(), "MMM d yyyy")).toMSecsSinceEpoch();
To get a datetime of the buildtime.
But is it possible that in cases this wont work, e.g. is it possible __DATE__ does not return Jul 14 2020 but in a local format e.g. chinese?
If the last is the case the todate method will not work right?
From C++ standard (draft):
http://eel.is/c++draft/cpp#predefined-1.2
The last sentence gives some freedom for compiler what to do if the date is not available. GCC does this:
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
To sum up - the format is fixed and it is always
"Mmm dd yyy", using English names.