Fixed linux RTC driver to make it return UTC time instead of local one

pull/88/head
tarxvf 2022-07-04 23:21:32 -04:00 zatwierdzone przez Silvano Seva
rodzic 111cb9e431
commit fc6849afb9
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -43,7 +43,7 @@ void rtc_terminate();
/**
* Set RTC time and calendar registers to a given value.
* @param t: struct of type curTime_t, whose content is used to initialise both
* @param t: struct of type datetime_t, whose content is used to initialise both
* clock and calendar registers.
*/
void rtc_setTime(datetime_t t);
@ -66,7 +66,7 @@ void rtc_setDate(uint8_t date, uint8_t month, uint8_t year);
/**
* Get current date and time.
* @return structure of type curTime_t with current clock and calendar values.
* @return structure of type datetime_t with current clock and calendar values.
*/
datetime_t rtc_getTime();

Wyświetl plik

@ -55,7 +55,8 @@ datetime_t rtc_getTime()
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
timeinfo = gmtime ( &rawtime );
//radio expects time to be TZ-less, so use gmtime instead of localtime.
t.hour = timeinfo->tm_hour;
t.minute = timeinfo->tm_min;