aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/timeutil.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-04 11:29:36 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-04 11:29:36 +0800
commitbacbb085895ae69e7f443cc39e04b686128a63a3 (patch)
tree63d7b824dc9827888fb1b77960e3971bcc390e25 /calendar/timeutil.c
parentf4295ffe09c2994a93eff4d4c73505f2bc291a59 (diff)
downloadgsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.gz
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.tar.zst
gsoc2013-evolution-bacbb085895ae69e7f443cc39e04b686128a63a3.zip
more and more fixes -mig
svn path=/trunk/; revision=104
Diffstat (limited to 'calendar/timeutil.c')
-rw-r--r--calendar/timeutil.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/calendar/timeutil.c b/calendar/timeutil.c
index 3a78bf2b4f..20d6fa7990 100644
--- a/calendar/timeutil.c
+++ b/calendar/timeutil.c
@@ -37,7 +37,7 @@ print_time_t (time_t t)
struct tm *tm = localtime (&t);
printf ("TIEMPO: %d/%d/%d %d:%d:%d\n",
- tm->tm_mday, tm->tm_mon, tm->tm_year,
+ tm->tm_mon+1, tm->tm_mday, tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec);
}
@@ -89,17 +89,32 @@ format_simple_hour (int hour, int use_am_pm)
}
time_t
-time_add_week (time_t time, int weeks)
-{
-}
-
-time_t
-time_add_day (time_t time, int weeks)
+time_add_day (time_t time, int days)
{
+ struct tm *tm = localtime (&time);
+ time_t new_time;
+
+ tm->tm_mday += days;
+ if ((new_time = mktime (tm)) == -1){
+ g_warning ("mktime could not handling adding a day with\n");
+ print_time_t (time);
+ return time;
+ }
+ return new_time;
}
time_t
time_add_year (time_t time, int years)
{
+ struct tm *tm = localtime (&time);
+ time_t new_time;
+
+ tm->tm_year += years;
+ if ((new_time = mktime (tm)) == -1){
+ g_warning ("mktime could not handling adding a year with\n");
+ print_time_t (time);
+ return time;
+ }
+ return new_time;
}