DATE et TIME are replaced automatically by the preprocessor by the date and time at compile time. If you uploaded right after, it's pretty close to the upload time. This is used for setting up the clock in RTC operations, you'll often see something like
if (! rtc.initialized()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
So,your code can know when it was compiled and it could ping an update server providing that info and server side you can compare to the file creation date of the latest binary in your repository to decide if you need an update
I'm not asking about retrieving DATE and TIME in sketch. I know how it works.
I'm asking about retrieving this data form compilation, to know when .bin file was compiled (what values of compilation date and time are compiled in file). Either from file data or at compilation process.
Create or mod date often do not retrieve right times (usually 1-3 sec. after compilation time).
I'm asking about retrieving this data form compilation, to know when .bin file was compiled (what values of compilation date and time are compiled in file). Either from file data or at compilation process.
Unless you do something to embed the date and time in the file, the date and time are not there!
Serial.print(DATE) is one way to embed the date in the file, although that doesn't allow you to get at it later.
char *date = DATE;
is another way that DOES allow you to get at the stored date.
ProgWeb:
I'm not asking about retrieving DATE and TIME in sketch. I know how it works.
I'm asking about retrieving this data form compilation, to know when .bin file was compiled (what values of compilation date and time are compiled in file). Either from file data or at compilation process.
Create or mod date often do not retrieve right times (usually 1-3 sec. after compilation time).
and can you explain how 1 to 3 second changes something? and what do you call "compile time"? is that compile, linking, building the final binary for upload?