#ifndef _GD32_Rtc_h__
#define _GD32_Rtc_h__
#include <stdint.h>

#define YEAR_20171201_UTS 	1512120700
#define YEAR_20571201_UTS 	2774424700

typedef void (*alarm_handler)(void);

extern unsigned char check_rtc_time(void);
extern unsigned char check_utc_stamp_valid(uint32_t utc);
extern void gd32_rtc_init(void);
extern int gd32_rtc_start_alarm(uint32_t sencod);
extern int gd32_rtc_update_alarm(uint32_t sencod);
extern void gd32_rtc_set_alarm_handler(alarm_handler handler);
extern void gd32_rtc_stop_alarm(void);
uint32_t rtc_get_timestamp(void);
extern uint64_t rtc_get_timestamp_ms(void);
extern void rtc_set_time_with_utc_second(uint32_t utc_s);

#endif /* _GD32_Rtc_h__ */
