[patch] gnomecal : erratic results when traversing DST boundaries.
- From: Mike McEwan <mike lotusland demon co uk>
- To: gnome-list gnome org
- Subject: [patch] gnomecal : erratic results when traversing DST boundaries.
- Date: 07 Jun 1999 23:41:52 +0100
I've been using `gnomecal' as downloaded from CVS earlier today. It
says 1.0.7, despite a posting from Miguel on this list that 1.0.8 had
been released?
Anyways, whilst using the `month' or `year' views, months/years were
being missed or "sticking" when using the toolbar's next/prev
buttons. A session with gdb revealed that these problems were occurring
when, in attempting to calculate the new time for a given view, a
daylight saving time boundary was being crossed. `mktime' was
undesirably adjusting its resultant time value by the appropriate DST
offset.
I've appended a patch, which I'm sending to this list as I don't know
where else to. There are probably a couple of other functions where
similar modifications should be made, but I thought I should keep
changes to the minimum that "did it" for me.
Connected with this, I noticed that when navigating months/years in
this way, the next entity switched to is in respect of the time value
stored in `gcal->current_display'. This means that if you go to say
`2010' in the year view, and then switch to a month view still showing
the current month in this year, the next month navigated to via the
next/prev toolbar buttons will be relative to that month in
`2010'. How should the various `views' operate? Should they `follow'
each other (e.g. if you got to `2010' in the year view and switch to
any of the other views, they would be displaying there day/week/month
values relative to `2010'), or should each `view' be navigable
independently of the others?
The patch...
1999-06-07 Mike McEwan <mike@lotusland.demon.co.uk>
* timeutil.c (time_add_month): Tell `mktime' that we don't know
about daylight saving time so that it does *not* make adjustments
when we traverse a DST boundary.
(time_year_begin): ditto.
(time_year_end): ditto.
(time_month_begin): ditto.
(time_month_end): ditto.
--- gncal/timeutil.c.orig Thu Mar 11 01:35:52 1999
+++ gncal/timeutil.c Mon Jun 7 20:30:48 1999
@@ -147,6 +147,7 @@
*/
tm->tm_mon += months;
+ tm->tm_isdst = -1;
if ((new_time = mktime (tm)) == -1){
g_warning ("mktime could not handling adding a month with\n");
print_time_t (time);
@@ -232,6 +233,7 @@
tm.tm_sec = 0;
tm.tm_mon = 0;
tm.tm_mday = 1;
+ tm.tm_isdst = -1;
return mktime (&tm);
}
@@ -248,6 +250,7 @@
tm.tm_mon = 0;
tm.tm_mday = 1;
tm.tm_year++;
+ tm.tm_isdst = -1;
return mktime (&tm);
}
@@ -262,6 +265,7 @@
tm.tm_min = 0;
tm.tm_sec = 0;
tm.tm_mday = 1;
+ tm.tm_isdst = -1;
return mktime (&tm);
}
@@ -277,6 +281,7 @@
tm.tm_sec = 0;
tm.tm_mday = 1;
tm.tm_mon++;
+ tm.tm_isdst = -1;
return mktime (&tm);
}
--
Mike.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]