mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
解决底层驱动格林威治时间与当地时间胡乱使用的问题 mktime函数改为timegm函数
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "board.h"
|
||||
#include "drv_rtc.h"
|
||||
#include <rtdevice.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "../libraries/ls1c_regs.h"
|
||||
#include "../libraries/ls1c_rtc.h"
|
||||
@@ -44,7 +45,7 @@ static time_t get_timestamp(void)
|
||||
tm_new.tm_mon = rtcDate.Month- 1;
|
||||
tm_new.tm_year = rtcDate.Year + 2000 - 1900;
|
||||
|
||||
return mktime(&tm_new);
|
||||
return timegm(&tm_new);
|
||||
}
|
||||
|
||||
static int set_timestamp(time_t timestamp)
|
||||
|
||||
Reference in New Issue
Block a user