X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibc.so_src%2Finclude_exp%2Ftime.h;h=c06d128cb2c268029e02f2bb5fc3b8a664a18954;hb=41f5d1923eac00f90097f80e51f0c1f8d1ab7cb3;hp=ce6932670d6e9913e9a815ba09ef39ac3a7ef12a;hpb=4c78a1bdd506cda6cda27ee342165c7dfa7ecdc2;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc.so_src/include_exp/time.h b/Usermode/Libraries/libc.so_src/include_exp/time.h index ce693267..c06d128c 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/time.h +++ b/Usermode/Libraries/libc.so_src/include_exp/time.h @@ -3,18 +3,22 @@ * - By John Hodge (thePowersGang) * * time.h - * - POSIX time functions + * - C99 Time Functions */ #ifndef _TIME_H_ #define _TIME_H_ -//#include #include // time_t +#include // size_t + +#ifdef __cplusplus +extern "C" { +#endif struct tm { - int tm_sec; - int tm_min; + int tm_sec; // 0-60 + int tm_min; // 0-59 int tm_hour; int tm_mday; int tm_mon; @@ -28,9 +32,45 @@ struct tm typedef signed long long clock_t; +//! Processor time used since invocation extern clock_t clock(void); +//! Difference between two times in seconds +extern double difftime(time_t time1, time_t time0); + +//! Convert a local time into the format returned by \a time +//! \note Also updates tm_wday and tm_yday to the correct values +extern time_t mktime(struct tm *timeptr); + +//! Get the current calendar time +//! \note -1 is returned if the calendar time is not avaliable extern time_t time(time_t *t); +// +// Time conversions +// +//! Convert the time structure into a string of form 'Sun Sep 16 01:03:52 1973\n\0' +extern char *asctime(const struct tm *timeptr); +extern char *asctime_r(const struct tm *timeptr, char *buf); + +//! asctime(localtime(timer)) +extern char *ctime(const time_t *timer); +extern char *ctime_r(const time_t *timer, char *buf); + +//! Convert \a timter into UTC +extern struct tm *gmtime(const time_t *timer); +extern struct tm *gmtime_r(const time_t *timer, struct tm *result); + +extern struct tm *localtime(const time_t *timer); +extern struct tm *localtime_r(const time_t *timep, struct tm *result); + +extern size_t strftime(char*s, size_t maxsize, const char*format, const struct tm*timeptr); + +#ifdef __cplusplus +}; +#endif + +#include + #endif