Simple 32bit value from 8bit RTC values example
Category: DateTime
DateTime Issues
mktime() causes crashing, memory leak??? We’ve found on the ESP32 that using this would cause inexplicable runtime crashing : Changing the definition to this sovled it:
Debug DateTime
Debug tm Debug time_t
Comparing date and time
Compare tm’s or with strptime() check Get time difference in seconds
struct tm
Struct tm Note:tm_year is years since 1900!!tm_month is months since January (0-11)!!Note when converting to time_t your year must be >= 1970 as time_t is usually based from 00:00, Jan 1 1970 UTC! Copy struct tm You can just use a normal equals:
Converting DateTime
Converting struct tm to time_t Convert UTC string to tm
Modifying Date and Time
Adjusting tm Adjusting time_t
UTC
UTC is the DateTime displayed in the following format: Convert UTC char string to tm and tm to a UTC formatted char string Note, strftime() returns the total number of characters written (not including the terminating null-character), or zero on error. To get a pointer to the next character in the char string being written […]
.DateTime General
Basics A time_t object is a raw system time value (typically seconds since 00:00, Jan 1 1970 UTC) A struct tm lets you work with days, hours, mins etc.