10 years, 10 months ago.

Question regarding __DATE__ and __TIME__

These are simple questions but I could not find them addressed in the forum already.

__DATE__ and __TIME__ appear to return GMT (side effect of a web-hosted compiler).  I have two questions:

1.  Is it possible to set a compiler flag to indicate the time zone that will affect the strings that __DATE__ and __TIME__ return?
2.  Do __DATE__ and __TIME__ understand daylight saving time?  I could wait until spring to find out, I suppose :)

Thanks.

2 Answers

10 years, 10 months ago.

Since it isn't possible to set flags in the online compiler, that for sure is no option. And GMT does not have daylight savings.

10 years, 10 months ago.

As stated https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html, ARMCC has some similar regarding this two macros. Both are computer dependent, so now it can be GMT , in the next compilation another time zone.

What's your use of them?

Didn't quite understand your answer, did you mean the next compilation of the web-based compiler, or the next compilation of my code?

I'm using them to create a version string that gets written to an EEPROM I have on a custom shield board mounted to a FRDM-KL25Z.

posted by Thomas Chamberlain 13 Feb 2015