I'm very confused as to how to get values from the time library.
The SimpleTime example is exactly NO help.
Firstly, there are many time.h files on my system;
there seem to be seven different versions; 18643; 7203; 2699; 2676; 1828; 399; and 21 bytes
The general idea is that they SEEM to create a structure holding these values
struct tm {
int8_t tm_sec; /< seconds after the minute - [ 0 to 59 ] */
int8_t tm_min; /< minutes after the hour - [ 0 to 59 ] */
int8_t tm_hour; /< hours since midnight - [ 0 to 23 ] */
int8_t tm_mday; /< day of the month - [ 1 to 31 ] */
int8_t tm_wday; /< days since Sunday - [ 0 to 6 ] */
int8_t tm_mon; /< months since January - [ 0 to 11 ] */
int16_t tm_year; /< years since 1900 */
int16_t tm_yday; /< days since January 1 - [ 0 to 365 ] */
int16_t tm_isdst; /**< Daylight Saving Time flag */
};
https://www.cplusplus.com/reference/ctime/tm/
From the SimpleTime example I can print the date and time like this
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
but I'm totally at a loss HOW that works. Although I have found the "format specifiers"
http://www.cplusplus.com/reference/ctime/strftime/
What I'm TRYING to do is
1: to create a string (yyyy_mm.csv eg 2021_04.csv) that I can use as a filename in SPIFFS;
I've now discovered I can do this:
strftime (buffer, 80, "%Y_%m.csv", &timeinfo); //4 digit year, 2 digit month
Serial.print("Filename is ");
Serial.println(buffer);
which outputs Filename is 2021_04.csv
2: to get the values of day, hour, minute, second as integers.
Any help greatly appreciated!