tm.h File Reference

Utility library for struct tm. More...

#include <time.h>
#include <sys/time.h>
#include <stdint.h>
#include "kernel_defines.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. More...
 
#define TM_WDAY_MON   (1)
 Monday in struct tm::tm_wday. More...
 
#define TM_WDAY_TUE   (2)
 Tuesday in struct tm::tm_wday. More...
 
#define TM_WDAY_WED   (3)
 Wednesday in struct tm::tm_wday. More...
 
#define TM_WDAY_THU   (4)
 Thursday in struct tm::tm_wday. More...
 
#define TM_WDAY_FRI   (5)
 Friday in struct tm::tm_wday. More...
 
#define TM_WDAY_SAT   (6)
 Saturday in struct tm::tm_wday. More...
 
#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) CONST
 Tells if a given year is a leap year in the Gregorian calendar. More...
 
int tm_doomsday (int year) CONST
 Returns the congruent weekday of the Doomsday (March 0). More...
 
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. More...
 
void tm_fill_derived_values (struct tm *tm)
 Fills in struct tm::tm_wday and struct tm::tm_yday given a date. More...
 
int tm_is_valid_date (int year, int mon, int mday) CONST
 Tests if a date is valid. More...
 
int tm_is_valid_time (int hour, int min, int sec) CONST
 Shallow test if a time is valid. More...
 

Variables

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