axle OS
x86_32 UNIX-like hobby OS
clock.h
1 #ifndef RTC_DRIVER_H
2 #define RTC_DRIVER_H
3 
4 #include <std/std.h>
5 
6 typedef struct time_t {
7  unsigned char second;
8  unsigned char minute;
9  unsigned char hour;
10  unsigned char day_of_week;
11  unsigned char day_of_month;
12  unsigned char month;
13  unsigned char year;
14 } time_t;
15 
16 //install rtc driver
17 void rtc_install();
18 
19 //return system time with millisecond precision
20 uint32_t time();
21 //to be used when unique id's are required, but accuracy is not.
22 //if time_unique() is called on the same timestamp more than once, it gaurantees the later request(s)
23 //have a unique id of their own.
24 uint32_t time_unique();
25 //UNIX timestamp
26 uint32_t epoch_time();
27 //get individual components
28 void gettime(time_t* time);
29 
30 //formatted timestamp
31 //user must provide sufficiently long buffer to store date
32 void date(char* dest);
33 
34 #endif
Definition: clock.h:6