diff options
Diffstat (limited to 'src/calendar.c')
-rwxr-xr-x | src/calendar.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/calendar.c b/src/calendar.c index c6a4676..94dd870 100755 --- a/src/calendar.c +++ b/src/calendar.c @@ -1,4 +1,4 @@ -/* $calcurse: calendar.c,v 1.16 2008/08/03 18:41:55 culot Exp $ */ +/* $calcurse: calendar.c,v 1.17 2008/08/10 09:24:46 culot Exp $ */ /* * Calcurse - text-based organizer @@ -399,7 +399,7 @@ calendar_change_day (int datefmt) * Used to change date by adding a certain amount of days or weeks. * Returns 0 on success, 1 otherwise. */ -int +static int date_change (struct tm *date, int delta_month, int delta_day) { struct tm t; @@ -485,6 +485,44 @@ calendar_move (move_t move) } } +/* Returns the beginning of current year as a long. */ +long +calendar_start_of_year (void) +{ + time_t timer; + struct tm *tm; + + timer = time (NULL); + tm = localtime (&timer); + tm->tm_mon = 0; + tm->tm_mday = 1; + tm->tm_hour = 0; + tm->tm_min = 0; + tm->tm_sec = 0; + timer = mktime (tm); + + return (long)timer; +} + +long +calendar_end_of_year (void) +{ + time_t timer; + struct tm *tm; + + timer = time (NULL); + tm = localtime (&timer); + tm->tm_mon = 0; + tm->tm_mday = 1; + tm->tm_hour = 0; + tm->tm_min = 0; + tm->tm_sec = 0; + tm->tm_year++; + timer = mktime (tm); + + return (long)(timer - 1); +} + /* * The pom, potm, dotr, adj360 are used to compute the current * phase of the moon. |