T-Box Basic dev
Loading...
Searching...
No Matches
sys_time.h File Reference

系统时间接口 More...

#include "tbox/time.h"

Go to the source code of this file.

Data Structures

struct  sys_ntp_server_t
struct  sys_time_config_t

Macros

#define SYS_TIME_NTP_SERVER_KEY1   "ro.time.ntp1"
#define SYS_TIME_NTP_SERVER_KEY2   "ro.time.ntp2"
#define SYS_TIME_NTP_SERVER_KEY3   "ro.time.ntp3"
#define SYS_TIME_NTP_SERVER_DFT_VAL1   "ntp.shu.edu.cn"
#define SYS_TIME_NTP_SERVER_DFT_VAL2   "ntp1.aliyun.com"
#define SYS_TIME_NTP_SERVER_DFT_VAL3   "ntp2.aliyun.com"
#define SYS_TIME_NTP_SERVER_ID_1   "ntp1"
#define SYS_TIME_NTP_SERVER_ID_2   "ntp2"
#define SYS_TIME_NTP_SERVER_ID_3   "ntp3"
#define SYS_TIME_ZONE_KEY   "ro.time.timezone"
#define SYS_TIME_ZONE_DEFAULT   "+08:00" /* 默认时区:东八区 */
#define SYS_TIME_ZONE_LEN   16 /* 时区字符串长度,如 "+08:00" */

Typedefs

typedef void(* sys_time_cb_t) (tbox_time_info_t *time_info_t, sys_time_calc_type_t type)

Enumerations

enum  sys_time_calc_type_t { SYS_TIME_TYPE_MCU_CALC , SYS_TIME_TYPE_GPS_CALC , SYS_TIME_TYPE_NTP_CALC , SYS_TIME_TYPE_TSP_CALC }

Functions

void sys_time_mcu_rtc (const uint8_t *data, uint32_t len)
 处理MCU RTC时间回调
void sys_time_create_oneshot (void)
 创建一次性校时任务
void sys_time_set_by_tsp (time_t ts)
 TSP 时间源设置系统时间

Detailed Description

系统时间接口

Version
1.0.0
Date
2026-07-03

Function Documentation

◆ sys_time_mcu_rtc()

void sys_time_mcu_rtc ( const uint8_t * data,
uint32_t len )

处理MCU RTC时间回调

Parameters
dataRTC数据
len数据长度

◆ sys_time_set_by_tsp()

void sys_time_set_by_tsp ( time_t ts)

TSP 时间源设置系统时间

Parameters
tsUnix 时间戳