mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
ztimer/periph_rtc: count months from 0
contrary to the western civilised world struct tm requires us to count months from 0
This commit is contained in:
parent
72213ec99a
commit
0b5709a853
@ -35,6 +35,9 @@
|
||||
static uint32_t _gmt_civil_to_timestamp(unsigned y, unsigned m, unsigned d,
|
||||
unsigned h, unsigned mi, unsigned s)
|
||||
{
|
||||
/* struct tm counts months from 0 to 11 */
|
||||
m += 1;
|
||||
|
||||
if (m <= 2) {
|
||||
y -= 1;
|
||||
m += 12;
|
||||
@ -71,6 +74,9 @@ void _timestamp_to_gmt_civil(struct tm *_tm, uint32_t epoch)
|
||||
.tm_hour = h, .tm_min = m, .tm_sec = s };
|
||||
*_tm = tmp;
|
||||
}
|
||||
|
||||
/* struct tm counts months starting from 0 */
|
||||
_tm->tm_mon -= 1;
|
||||
}
|
||||
|
||||
static void _ztimer_periph_rtc_callback(void *arg)
|
||||
|
Loading…
Reference in New Issue
Block a user