You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
2 years ago
|
/**
|
||
|
* @file time_clock.h
|
||
|
* @author Chen Jihang (embedded@eseaoptics.com)
|
||
|
* @brief 提供与时间和时钟相关函数
|
||
|
* @version 0.1
|
||
|
* @date 2022-07-18
|
||
|
*
|
||
|
* @copyright ESEA (c) 2020
|
||
|
*
|
||
|
*/
|
||
|
#ifndef TIME_CLOCK_H_
|
||
|
#define TIME_CLOCK_H_
|
||
|
#include "stdint.h"
|
||
|
#include "time.h"
|
||
|
struct time_clock_time
|
||
|
{
|
||
|
uint64_t time_s;
|
||
|
uint32_t time_ms;
|
||
|
};
|
||
|
struct time_clock_date
|
||
|
{
|
||
|
uint8_t sec;
|
||
|
uint8_t min;
|
||
|
uint8_t hour;
|
||
|
uint8_t mday;
|
||
|
uint8_t wday;
|
||
|
uint8_t mon;
|
||
|
uint16_t year;
|
||
|
uint16_t yday;
|
||
|
};
|
||
|
|
||
|
uint64_t time_clock_get_time_s(void);
|
||
|
uint32_t time_clock_get_time_ms(void);
|
||
|
struct time_clock_time *time_clock_get_time(struct time_clock_time *ptime);
|
||
|
int64_t time_clock_get_time_offset_ms(struct time_clock_time *ptime);
|
||
|
int64_t time_clock_get_time_offset_s(uint64_t time_s);
|
||
|
void time_clock_set_time(struct time_clock_time *ptime_to_set,struct time_clock_time *ptime);
|
||
|
struct time_clock_date *time_clock_time_to_date(uint64_t time_s,struct time_clock_date *date,int8_t time_zone);
|
||
|
uint64_t time_clock_date_to_time(struct time_clock_date *date,int8_t time_zone);
|
||
|
uint32_t time_clock_get_time_str(char *buf,int8_t time_zone);
|
||
|
void time_clock_tick_callback(void);
|
||
|
#endif
|