Fixed linux RTC driver to make it return UTC time instead of local one
This commit is contained in:
parent
111cb9e431
commit
fc6849afb9
|
|
@ -43,7 +43,7 @@ void rtc_terminate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set RTC time and calendar registers to a given value.
|
* 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.
|
* clock and calendar registers.
|
||||||
*/
|
*/
|
||||||
void rtc_setTime(datetime_t t);
|
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.
|
* 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();
|
datetime_t rtc_getTime();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ datetime_t rtc_getTime()
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm * timeinfo;
|
struct tm * timeinfo;
|
||||||
time ( &rawtime );
|
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.hour = timeinfo->tm_hour;
|
||||||
t.minute = timeinfo->tm_min;
|
t.minute = timeinfo->tm_min;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue