请问CBU模组的哪个API可以通过输入年月日时分秒获取时间戳
【已同步】请问CBU模组的哪个API可以通过输入年月日时分秒获取时间戳
Re: 请问CBU模组的哪个API可以通过输入年月日时分秒获取时间戳
tuyaos 系列可以用tal_time_mktime来转换,其他的你可以搜一下mktime,也有一个差不多的函数。
Code: Select all
/**
* @brief posix time
*
*/
typedef struct {
INT_T tm_sec; /* seconds [0-59] */
INT_T tm_min; /* minutes [0-59] */
INT_T tm_hour; /* hours [0-23] */
INT_T tm_mday; /* day of the month [1-31] */
INT_T tm_mon; /* month [0-11] */
INT_T tm_year; /* year. The number of years since 1900 */
INT_T tm_wday; /* day of the week [0-6] 0-Sunday...6-Saturday */
}POSIX_TM_S;
/**
* @brief change posix time to TIME_T, redefine the std C func mktime
*
* @param[in] tm the time in posix time format
* @return the time in TIME_T format
*/
TIME_T tal_time_mktime(IN CONST POSIX_TM_S *tm);