From e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 16 Jul 1999 19:15:34 +0000 Subject: Changed gnome-pim.keys to use the --file flag Changed gnome-pim.keys to use the --file flag 1999-07-14 Miguel de Icaza * calobj.c (ical_gen_uid): Returns a UID. (ical_object_new): Use a UID when creating an event. Should get syncing done easier. 1999-07-14 Nicholas J Kreucher * calobj.c (skip_numbers): Actually skip over the numbers. (ical_object_to_vobject): Test the proper variable for storing the proper information. svn path=/trunk/; revision=1027 --- calendar/timeutil.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'calendar/timeutil.c') diff --git a/calendar/timeutil.c b/calendar/timeutil.c index 77a468471e..10b9483af0 100644 --- a/calendar/timeutil.c +++ b/calendar/timeutil.c @@ -141,11 +141,10 @@ time_add_month (time_t time, int months) { struct tm *tm = localtime (&time); time_t new_time; + int mday; - /* FIXME: this will not work correctly when switching, say, from a 31-day month to a 30-day - * month. Figure out the number of days in the month and go to the nearest "limit" day. - */ - + mday = tm->tm_mday; + tm->tm_mon += months; tm->tm_isdst = -1; if ((new_time = mktime (tm)) == -1){ @@ -153,7 +152,14 @@ time_add_month (time_t time, int months) print_time_t (time); return time; } - return new_time; + tm = localtime (&new_time); + if (tm->tm_mday < mday){ + tm->tm_mon--; + tm->tm_mday = time_days_in_month (tm->tm_year+1900, tm->tm_mon); + return new_time = mktime (tm); + } + else + return new_time; } time_t -- cgit v1.2.3