From 55f88f14fed53f67e4b3cd5337cbe92aee0ec638 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Fri, 17 Apr 1998 19:35:43 +0000 Subject: Large number of updates. Recurrence basically works now in most of its Large number of updates. Recurrence basically works now in most of its forms (daily, weekly, month-by-position). Miguel. svn path=/trunk/; revision=148 --- calendar/timeutil.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'calendar/timeutil.c') diff --git a/calendar/timeutil.c b/calendar/timeutil.c index 63b78a4152..3e912a0fa3 100644 --- a/calendar/timeutil.c +++ b/calendar/timeutil.c @@ -122,15 +122,13 @@ time_t time_day_hour (time_t t, int hour) { struct tm tm; - time_t retval; tm = *localtime (&t); tm.tm_hour = hour; tm.tm_min = 0; tm.tm_sec = 0; - retval = mktime (&tm); - return retval; + return mktime (&tm); } @@ -138,22 +136,19 @@ time_t time_start_of_day (time_t t) { struct tm tm; - time_t retval; tm = *localtime (&t); tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; - retval = mktime (&tm); - return retval; + return mktime (&tm); } time_t time_end_of_day (time_t t) { struct tm tm; - time_t retval; tm = *localtime (&t); tm.tm_hour = 0; @@ -161,8 +156,7 @@ time_end_of_day (time_t t) tm.tm_sec = 0; tm.tm_mday++; - retval = mktime (&tm); - return retval; + return mktime (&tm); } time_t @@ -187,7 +181,6 @@ time_t time_year_end (int year) { struct tm tm; - time_t retval; tm.tm_hour = 23; tm.tm_min = 59; @@ -197,6 +190,17 @@ time_year_end (int year) tm.tm_mday = 31; tm.tm_isdst = -1; - retval = mktime (&tm); - return retval; + return mktime (&tm); +} + +time_t +time_week_begin (time_t t) +{ + struct tm tm; + time_t retval; + + tm = *localtime (&t); + tm.tm_mday -= tm.tm_wday; + return mktime (&tm); } + -- cgit