From b265b27dfc1e68424d509a17b9c6466adbae3fc9 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 11 Apr 1998 23:32:49 +0000 Subject: More work on the recurrence dialog box, day navigation -mig svn path=/trunk/; revision=126 --- calendar/timeutil.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'calendar/timeutil.c') diff --git a/calendar/timeutil.c b/calendar/timeutil.c index acd2b33ee7..c19b394be9 100644 --- a/calendar/timeutil.c +++ b/calendar/timeutil.c @@ -117,3 +117,51 @@ time_add_year (time_t time, int years) } return new_time; } + +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; +} + + +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; +} + +time_t +time_end_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; + tm.tm_mday++; + + retval = mktime (&tm); + return retval; +} + -- cgit