TuyaOS
tal_time_service.h
浏览该文件的文档.
1
11#ifndef __TAL_TIME_SERVICE_H__
12#define __TAL_TIME_SERVICE_H__
13
14#include "tuya_cloud_types.h"
15#include "tal_system.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
26typedef struct {
27 INT_T tm_sec; /* seconds [0-59] */
28 INT_T tm_min; /* minutes [0-59] */
29 INT_T tm_hour; /* hours [0-23] */
30 INT_T tm_mday; /* day of the month [1-31] */
31 INT_T tm_mon; /* month [0-11] */
32 INT_T tm_year; /* year. The number of years since 1900 */
33 INT_T tm_wday; /* day of the week [0-6] 0-Sunday...6-Saturday */
35
40typedef struct {
41 TIME_T posix_min; // summer time start
42 TIME_T posix_max; // summer time end
44
49#define SUM_ZONE_TAB_LMT 6
50
55typedef struct {
56 UINT_T cnt; //sum zone count
57 SUM_ZONE_S zone[SUM_ZONE_TAB_LMT];//zone info
59
65OPERATE_RET tal_time_service_init(VOID);
66
73TIME_T tal_time_mktime(IN CONST POSIX_TM_S *tm);
74
82POSIX_TM_S *tal_time_gmtime_r(IN CONST TIME_T *tm, OUT POSIX_TM_S *result);
83
89OPERATE_RET tal_time_check_time_sync(VOID);
90
97
104OPERATE_RET tal_time_set(IN CONST POSIX_TM_S *tm);
105
113OPERATE_RET tal_time_set_posix(IN CONST TIME_T time, IN CONST INT_T update_source);
114
121OPERATE_RET tal_time_get(OUT POSIX_TM_S *tm);
122
129
135SYS_TICK_T tal_time_get_posix_ms(VOID);
136
143
151VOID tal_time_get_system_time(OUT TIME_S *pSecTime,OUT TIME_MS *pMsTime);
152
159OPERATE_RET tal_time_set_time_zone(IN CONST CHAR_T *time_zone);
160
167OPERATE_RET tal_time_set_time_zone_seconds(IN INT_T time_zone_sec);
168
175OPERATE_RET tal_time_get_time_zone_seconds(OUT INT_T *time_zone);
176
184VOID tal_time_set_sum_zone_tbl(IN CONST SUM_ZONE_S *zone,IN CONST UINT_T cnt);
185
193
200
206BOOL_T tal_time_is_in_sum_zone(TIME_T time);
207
208
219OPERATE_RET tal_time_get_local_time_custom(IN TIME_T in_time, OUT POSIX_TM_S *tm);
220
227OPERATE_RET tal_time_get_sum_zone(OUT SUM_ZONE_TBL_S *sum_zone);
228
229#ifdef __cplusplus
230}
231#endif /* __cplusplus */
232
233#endif /* __TAL_TIME_SERVICE_H__ */
234
235
posix time
Definition: tal_time_service.h:26
summer time zone
Definition: tal_time_service.h:40
sum zone info
Definition: tal_time_service.h:55
This is tal_system file
OPERATE_RET tal_time_set_posix(IN CONST TIME_T time, IN CONST INT_T update_source)
set IoTOS UTC time in time_t format
OPERATE_RET tal_time_get(OUT POSIX_TM_S *tm)
get IoTOS UTC time in posix time format
VOID tal_time_set_sum_zone_tbl(IN CONST SUM_ZONE_S *zone, IN CONST UINT_T cnt)
set IoTOS summer time zone
OPERATE_RET tal_time_check_time_sync(VOID)
check IoTOS time synchronize status
TIME_T tal_time_mktime(IN CONST POSIX_TM_S *tm)
change posix time to TIME_T, redefine the std C func mktime
TIME_T tal_time_get_posix(VOID)
get IoTOS UTC time in TIME_T format
OPERATE_RET tal_time_get_sum_time(OUT POSIX_TM_S *tm)
get IoTOS UTC summer time in posix time format
OPERATE_RET tal_time_set(IN CONST POSIX_TM_S *tm)
set IoTOS UTC time
POSIX_TM_S * tal_time_gmtime_r(IN CONST TIME_T *tm, OUT POSIX_TM_S *result)
change TIME_T to posix time, redefine the std C func gmtime_r
OPERATE_RET tal_time_check_time_zone_sync(VOID)
check IoTOS time zone synchronized status
OPERATE_RET tal_time_get_sum_zone(OUT SUM_ZONE_TBL_S *sum_zone)
get sum zone info
OPERATE_RET tal_time_set_time_zone(IN CONST CHAR_T *time_zone)
set IoTOS time zone in "+/-hh:mm" format
OPERATE_RET tal_time_get_time_zone_seconds(OUT INT_T *time_zone)
get IoTOS time zone in second format
BOOL_T tal_time_is_in_sum_zone(TIME_T time)
get IoTOS UTC summer time int TIME_T format
TIME_T tal_time_get_sum_time_posix(VOID)
get IoTOS UTC summer time int TIME_T format
OPERATE_RET tal_time_service_init(VOID)
time-management module initialization
#define SUM_ZONE_TAB_LMT
number of time zone table
Definition: tal_time_service.h:49
OPERATE_RET tal_time_get_local_time_custom(IN TIME_T in_time, OUT POSIX_TM_S *tm)
get IoTOS local time (local, contains the time zone and summer time zone)
OPERATE_RET tal_time_set_time_zone_seconds(IN INT_T time_zone_sec)
set IoTOS time zone in second format
TIME_T tal_time_get_cur_posix(VOID)
get IoTOS last synchronized UTC time in TIME_T format
VOID tal_time_get_system_time(OUT TIME_S *pSecTime, OUT TIME_MS *pMsTime)
get IoTOS UTC time, both second and micro-second
SYS_TICK_T tal_time_get_posix_ms(VOID)
get IoTOS UTC time in SYS_TICK_T format