aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gncal-week-view.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-22 09:15:42 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-22 09:15:42 +0800
commit1e77e73903d1604ed8b46c9979ef2d948c46383c (patch)
treef577617200ca81a52ed6d50ee45ab8ac92149c08 /calendar/gncal-week-view.c
parent45abc2cbefa6d1dfafeb6a8351c35d5c841f87c8 (diff)
downloadgsoc2013-evolution-1e77e73903d1604ed8b46c9979ef2d948c46383c.tar.gz
gsoc2013-evolution-1e77e73903d1604ed8b46c9979ef2d948c46383c.tar.zst
gsoc2013-evolution-1e77e73903d1604ed8b46c9979ef2d948c46383c.zip
Small fix for goto-day-year computation -mig
svn path=/trunk/; revision=179
Diffstat (limited to 'calendar/gncal-week-view.c')
-rw-r--r--calendar/gncal-week-view.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/calendar/gncal-week-view.c b/calendar/gncal-week-view.c
index 7de8899cb3..ab5e7fbea0 100644
--- a/calendar/gncal-week-view.c
+++ b/calendar/gncal-week-view.c
@@ -175,8 +175,8 @@ gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
void
gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
{
- struct tm tm, start;
- time_t day_start, day_end;
+ struct tm tm;
+ time_t day_start, day_end, week_start, week_end;
int i;
g_return_if_fail (wview != NULL);
@@ -187,15 +187,14 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
/* back up to start of week (Monday) */
tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
-
+
/* Start of day */
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
- day_start = mktime (&tm);
- start = tm;
+ day_start = week_start = mktime (&tm);
/* Calendar */
@@ -218,11 +217,16 @@ gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
{
char buf [80];
int len;
+ struct tm *t;
- strftime (buf, sizeof (buf), "%A %d %Y - ", &start);
- len = strlen (buf);
+ week_end = time_add_day (week_start, 6);
+ t = localtime (&week_start);
- strftime (buf + len, sizeof (buf) - len, "%A %d %Y", &tm);
+ strftime (buf, sizeof (buf), "%A %d %Y - ", t);
+ len = strlen (buf);
+
+ t = localtime (&week_end);
+ strftime (buf + len, sizeof (buf) - len, "%A %d %Y", t);
gtk_label_set (GTK_LABEL (wview->label), buf);
}