Loading...
Searching...
No Matches
tm.h File Reference

Utility library for struct tm. More...

Detailed Description

Utility library for struct tm.

Definition in file tm.h.

#include <time.h>
#include <stdint.h>
+ Include dependency graph for tm.h:

Go to the source code of this file.

Macros

#define TM_WDAY_SUN   (0)
 Sunday in struct tm::tm_wday.
 
#define TM_WDAY_MON   (1)
 Monday in struct tm::tm_wday.
 
#define TM_WDAY_TUE   (2)
 Tuesday in struct tm::tm_wday.
 
#define TM_WDAY_WED   (3)
 Wednesday in struct tm::tm_wday.
 
#define TM_WDAY_THU   (4)
 Thursday in struct tm::tm_wday.
 
#define TM_WDAY_FRI   (5)
 Friday in struct tm::tm_wday.
 
#define TM_WDAY_SAT   (6)
 Saturday in struct tm::tm_wday.
 
#define TM_MON_JAN   ( 0)
 January in struct tm::tm_mon
 
#define TM_MON_FEB   ( 1)
 February in struct tm::tm_mon
 
#define TM_MON_MAR   ( 2)
 March in struct tm::tm_mon
 
#define TM_MON_APR   ( 3)
 April in struct tm::tm_mon
 
#define TM_MON_MAY   ( 4)
 May in struct tm::tm_mon
 
#define TM_MON_JUN   ( 5)
 June in struct tm::tm_mon
 
#define TM_MON_JUL   ( 6)
 July in struct tm::tm_mon
 
#define TM_MON_AUG   ( 7)
 August in struct tm::tm_mon
 
#define TM_MON_SEP   ( 8)
 September in struct tm::tm_mon
 
#define TM_MON_OCT   ( 9)
 October in struct tm::tm_mon
 
#define TM_MON_NOV   (10)
 November in struct tm::tm_mon
 
#define TM_MON_DEC   (11)
 December in struct tm::tm_mon
 

Functions

int tm_is_leap_year (unsigned year)
 Tells if a given year is a leap year in the Gregorian calendar.
 
int tm_doomsday (int year)
 Returns the congruent weekday of the Doomsday (March 0).
 
void tm_get_wyday (int year, int mon, int mday, int *wday, int *yday)
 Calculates the day of the year and the weekday of a given date.
 
void tm_fill_derived_values (struct tm *tm)
 Fills in struct tm::tm_wday and struct tm::tm_yday given a date.
 
int tm_is_valid_date (int year, int mon, int mday)
 Tests if a date is valid.
 
int tm_is_valid_time (int hour, int min, int sec)
 Shallow test if a time is valid.
 

Variables

const int8_t TM_MON_DAYS [12]
 The number of days in common years.
 
const int16_t TM_MON_DAYS_ACCU [12]
 The prefixsum of the number of days in common years.