Usermode/libc - Fix time conversion code
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / timeconv.h
1 /*
2  * Acess2 C Library
3  * - By John Hodge (thePowersGang)
4  *
5  * timeconv.h
6  * - Shared User/Kernel time conversion code
7  */
8 #ifndef _LIBC_TIMECONV_H_
9 #define _LIBC_TIMECONV_H_
10
11 #include <stdint.h>
12 #include <stdbool.h>
13
14 extern int64_t  seconds_since_y2k(int years_since, int mon, int day, int h, int m, int s);
15
16 /**
17  * \return Number of days since Y2K
18  * 
19  * Extracts the time of day from the timestamp, (possibly taking into account leap seconds)
20  */
21 extern int64_t  get_days_since_y2k(int64_t ts, int *h, int *m, int *s);
22
23 /**
24  * \param days  Number of days since Y2K
25  * \return Number of years since Y2K
26  * 
27  * Converts a count of days since Y2K, and returns the number of years. Extracting the day of
28  * year, and if that year is a leap year.
29  */
30 extern int64_t  get_years_since_y2k(int64_t days, bool *is_leap, int *doy);
31
32
33 /**
34  * Gets the month and day of month from a day of year and leap year status
35  */
36 extern void     get_month_day(int doy, bool is_ly, int *mon, int *day);
37
38 #endif
39

UCC git Repository :: git.ucc.asn.au