aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/timeutil.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-07-17 03:15:34 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-07-17 03:15:34 +0800
commite1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee (patch)
tree16a13fb1faf0ca28b2b97967668bd6e43c209ff6 /calendar/timeutil.c
parent4a765990e54c4caeb9880ffac8994cf64f23baae (diff)
downloadgsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.tar
gsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.tar.gz
gsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.tar.bz2
gsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.tar.lz
gsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.tar.xz
gsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.tar.zst
gsoc2013-evolution-e1c1c85819bbfb3f0fc6cfaf52e88d1dae6441ee.zip
Changed gnome-pim.keys to use the --file flag
Changed gnome-pim.keys to use the --file flag 1999-07-14 Miguel de Icaza <miguel@gnu.org> * 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 <nick@poetic.com> * 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
Diffstat (limited to 'calendar/timeutil.c')
-rw-r--r--calendar/timeutil.c16
1 files changed, 11 insertions, 5 deletions
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