31 lines
885 B
C
31 lines
885 B
C
|
#pragma once
|
||
|
|
||
|
#include <stddef.h>
|
||
|
|
||
|
struct Time {
|
||
|
int sec; /// Seconds [0,59]
|
||
|
int min; /// Minutes [0,59]
|
||
|
int hour; /// Hour [0,23]
|
||
|
int mday; /// Day of month [1,31]
|
||
|
int mon; /// Month of year [0,11]
|
||
|
int year; /// Years since 1900
|
||
|
int wday; /// Day of week [0,6] (Sunday = 0)
|
||
|
int yday; /// Day of year [0,365]
|
||
|
int yn; /// Year number [0,99]
|
||
|
int cen; /// Century [19,20]
|
||
|
int leap; /// If year is a leap year (True == 1)
|
||
|
};
|
||
|
|
||
|
extern void rtc_update(void);
|
||
|
extern void rtc_set_timezone(int offset);
|
||
|
extern struct Time *rtc_utctime(void);
|
||
|
extern struct Time *rtc_localtime(void);
|
||
|
|
||
|
/**
|
||
|
* Converts the time into a string format
|
||
|
* @param time the current time
|
||
|
* @param format see manpage for date
|
||
|
* @param buf the buffer to store it in
|
||
|
*/
|
||
|
extern void timetostr(struct Time *time, char *format, char *buf, size_t n);
|