avr-fw-modules/core/src/seconds_from_midnight.c

18 lines
276 B
C
Executable File

#include <sys/time.h>
#include <stdlib.h>
uint32_t seconds_from_midnight(datetime_t *datetime){
uint32_t r;
datetime_t dt;
if (datetime){
dt = *datetime;
r = dt.second + (dt.minute*60) + (dt.hour * 3600l);
} else {
r = unixtime() % (86400l);
};
return r;
};