Mstdlib-1.24.0
|
Functions | |
M_time_t | M_time (void) |
M_bool | M_time_gettimeofday (M_timeval_t *tv) |
int | M_time_days_in_month (M_int64 year, M_int64 month) |
M_bool | M_time_is_valid_day (M_int64 year, M_int64 month, M_int64 day) |
void | M_time_normalize_tm (struct M_time_tm *tm) |
M_time_t | M_time_fromlocal (M_time_localtm_t *ltime, const M_time_tz_t *tz) |
void | M_time_tolocal (M_time_t t, M_time_localtm_t *ltime, const M_time_tz_t *tz) |
void | M_time_togm (M_time_t t, M_time_gmtm_t *tm) |
M_time_t | M_time_fromgm (M_time_gmtm_t *tm) |
M_time_t M_time | ( | void | ) |
Get the system time.
While M_time_t is guaranteed to be 64 bit the time returned is not. Time is dependent on the platform and some only support 32 bit time values. On these systems M_time will only return a value up to Jan 19, 2038 03:14:07 UTC.
M_bool M_time_gettimeofday | ( | M_timeval_t * | tv | ) |
Get the number of seconds and milliseconds since Epoch.
[out] | tv | The time as seconds and milliseconds since Epoch. |
int M_time_days_in_month | ( | M_int64 | year, |
M_int64 | month | ||
) |
Get the number of days in a given month for a given year.
Accounts for leap years.
[in] | year | The year. |
[in] | month | The month. 1-12. |
M_bool M_time_is_valid_day | ( | M_int64 | year, |
M_int64 | month, | ||
M_int64 | day | ||
) |
Determine if a give day of month valid for the given month for a given year.
[in] | year | The year. |
[in] | month | The month. |
[in] | day | The day of month. |
void M_time_normalize_tm | ( | struct M_time_tm * | tm | ) |
Normalize a struct tm.
If adjustments are made to a struct tm this will bring the adjustments back to a real date/time.
This does not modify the isdst, gmtoff or abbr fields of the struct. These may be wrong if the adjust time crosses a DST boundary for example. Use M_time_fromlocal with the appropriate time zone data (or NULL if using the systems current info) to normalize a time taking into account these fields. Or use M_time_fromgm if dealing with a gm time (isdst, gmtoff and abbr will be cleared).
[in,out] | tm | The tm to normalize. |
M_time_t M_time_fromlocal | ( | M_time_localtm_t * | ltime, |
const M_time_tz_t * | tz | ||
) |
Convert a local time to a UTC time.
[in,out] | ltime | The local time structure to convert. This will be normalized. |
[in] | tz | The time zone the local time is in. |
void M_time_tolocal | ( | M_time_t | t, |
M_time_localtm_t * | ltime, | ||
const M_time_tz_t * | tz | ||
) |
Convert a UTC time to a local time struct.
[in] | t | The UTC time. |
[out] | ltime | The local time struct. |
[in] | tz | The time zone the local time is in. |
void M_time_togm | ( | M_time_t | t, |
M_time_gmtm_t * | tm | ||
) |
Convert a UTC time to a broken out time struct.
[in] | t | UTC time. |
[out] | tm | Time struct. |
M_time_t M_time_fromgm | ( | M_time_gmtm_t * | tm | ) |
Convert a broken out time struct to a unix timestamp.
[in,out] | tm | The time struct. This will be normalized. |