MIRDATE(3) BSD Programmer's Manual MIRDATE(3)
mirtime_getleaps, mirtime_isleap, timet2posix, posix2timet, timet2mjd, mjd2timet, timet2tm, tm2timet, mjd_explode, mjd_implode - MirBSD time API
const time_t * mirtime_getleaps(void); int mirtime_isleap(time_t t); time_t timet2posix(time_t t); time_t posix2timet(time_t t); mirtime_mjd * timet2mjd(mirtime_mjd *mjd, time_t t); time_t mjd2timet(mirtime_mjd *mjd); struct tm * timet2tm(struct tm *dst, time_t src); time_t tm2timet(struct tm *src); struct tm * mjd_explode(struct tm *tm, mirtime_mjd *mjd); mirtime_mjd * mjd_implode(mirtime_mjd *mjd, struct tm *tm);
The mirtime_getleaps() function returns a pointer, which is guaranteed to be not NULL, to a read-only array of time_t values that are leap seconds, terminated by a value of 0. This function uses a table which should be initialised with tzset() beforehand if mechanisms such as chroot(2) are employed. The mirtime_isleap() function returns 1 if t is known to be a (positive) leap second, 0 otherwise. The remaining functions mentioned convert time values between a broken- down calendar date struct tm, a Modified Julian Date mirtime_mjd, seconds since the First of January, 1970, midnight UTC time_t, and POSIX time (seconds since the epoch, 86400 seconds per day), also stored in time_t. mjd_implode() and tm2timet() parse the fields tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_gmtoff of struct tm; mjd_explode() and timet2tm() fill in the fields tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday, tm_yday with sensible values and tm_isdst, tm_gmtoff, tm_zone with null values. To use these functions, macros and types, include at least one of <sys/time.h> and/or <time.h> and check whether the macro SYSKERN_MIRTIME_H is defined (currently to the value 1).
time_t is a signed integral type of 32 or 64 bit, machine-dependent. struct tm consists of the following slots: int tm_sec; /* seconds [0-60] */ int tm_min; /* minutes [0-59] */ int tm_hour; /* hours [0-23] */ int tm_mday; /* day of month [1-31] */ int tm_mon; /* month of year - 1 [0-11] */ time_t tm_year; /* year - 1900 */ int tm_wday; /* day of week (0 = sunday) */ int tm_yday; /* day of year [0-365] */ int tm_isdst; /* summer time effective? [0/1] */ long tm_gmtoff; /* offset from UTC in seconds */ char *tm_zone; /* abbreviation of timezone name */ mirtime_mjd consists of the following slots: time_t mjd; /* day of modified julian calendar */ int32_t sec; /* second within the day [0-86400] */
chroot(2), mktime(3), tzset(3)
This set of functions expects your operating system to not conform to IEEE Std 1003.1 ("POSIX") for correct time_t handling.
This API replaced a DJB-inspired TAI API with MirOS #11.
Thorsten "mirabilos" Glaser <email@example.com>
The leap second table is read from the timezone information file. This has implications on the location of the file and its up-to-dateness. There is no method to select POSIX-conformant behaviour. It's probably better this way, though. Few sanitising of values is done, but the functions are considered safe. MirOS BSD #10-current November 20, 2011 1
Generated on 2015-10-06 19:36:22 by $MirOS: src/scripts/roff2htm,v 1.80 2015/01/02 13:54:19 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2015 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.