]> Pileus Git - lackey/blob - src/util.h
57e7afca2ddb631f7df984fc8b8cd36a6f1b81ce
[lackey] / src / util.h
1 /* Types */
2 typedef int year_t;
3 typedef int day_t;
4
5 typedef enum {
6         JAN =  0,
7         FEB =  1,
8         MAR =  2,
9         APR =  3,
10         MAY =  4,
11         JUN =  5,
12         JUL =  6,
13         AUG =  7,
14         SEP =  8,
15         OCT =  9,
16         NOV = 10,
17         DEC = 11,
18 } month_t;
19
20 typedef enum {
21         SUN = 0,
22         MON = 1,
23         TUE = 2,
24         WED = 3,
25         THU = 4,
26         FRI = 5,
27         SAT = 6,
28 } wday_t;
29
30 /* Time functions */
31 int days_in_year(year_t year);
32 int days_in_month(year_t year, month_t month);
33 int weeks_in_month(year_t year, month_t month);
34 wday_t start_of_month(year_t year, month_t month);
35
36 /* String functions */
37 const char *month_to_str(month_t month);
38 const char *month_to_string(month_t month);
39 const char *day_to_st(wday_t day);
40 const char *day_to_str(wday_t day);
41 const char *day_to_string(wday_t day);
42
43 /* Tests */
44 void test_time(void);