X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibc.so_src%2Ftimeconv.h;fp=Usermode%2FLibraries%2Flibc.so_src%2Ftimeconv.h;h=1adba8f8db592f2dfc92b311ea68f72a1b1ce0af;hb=2610c32930309a73308f64731a05f2e83487b731;hp=0000000000000000000000000000000000000000;hpb=d4b3582f716e06672de2d374be06064118236aed;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc.so_src/timeconv.h b/Usermode/Libraries/libc.so_src/timeconv.h new file mode 100644 index 00000000..1adba8f8 --- /dev/null +++ b/Usermode/Libraries/libc.so_src/timeconv.h @@ -0,0 +1,39 @@ +/* + * Acess2 C Library + * - By John Hodge (thePowersGang) + * + * timeconv.h + * - Shared User/Kernel time conversion code + */ +#ifndef _LIBC_TIMECONV_H_ +#define _LIBC_TIMECONV_H_ + +#include +#include + +extern int64_t seconds_since_y2k(int years_since, int mon, int day, int h, int m, int s); + +/** + * \return Number of days since Y2K + * + * Extracts the time of day from the timestamp, (possibly taking into account leap seconds) + */ +extern int64_t get_days_since_y2k(int64_t ts, int *h, int *m, int *s); + +/** + * \param days Number of days since Y2K + * \return Number of years since Y2K + * + * Converts a count of days since Y2K, and returns the number of years. Extracting the day of + * year, and if that year is a leap year. + */ +extern int64_t get_years_since_y2k(int64_t days, bool *is_leap, int *doy); + + +/** + * Gets the month and day of month from a day of year and leap year status + */ +extern void get_month_day(int doy, bool is_ly, int *mon, int *day); + +#endif +