summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/apoint.c2
-rw-r--r--src/calcurse.h6
-rw-r--r--src/day.c2
-rw-r--r--src/ui-calendar.c2
4 files changed, 9 insertions, 3 deletions
diff --git a/src/apoint.c b/src/apoint.c
index c485477..d200cf3 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -137,7 +137,7 @@ void apoint_sec2str(struct apoint *o, long day, char *start, char *end)
snprintf(start, HRMIN_SIZE, "%02u:%02u", lt.tm_hour,
lt.tm_min);
}
- if (o->start + o->dur > day + DAYINSEC) {
+ if (o->start + o->dur > day + DAYLEN(day)) {
strncpy(end, "..:..", 6);
} else {
t = o->start + o->dur;
diff --git a/src/calcurse.h b/src/calcurse.h
index fb20da7..616d954 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -144,7 +144,13 @@
#define WEEKINMIN (WEEKINHOURS * HOURINMIN)
#define WEEKINSEC (WEEKINMIN * MININSEC)
#define DAYINMIN (DAYINHOURS * HOURINMIN)
+/*
+ * Note the difference between the number of seconds in a day and daylength
+ * in seconds. The two may differ when DST is in effect (daylength is either
+ * 23, 24 or 25 hours. The argument to DAYLEN is of type time_t.
+ */
#define DAYINSEC (DAYINMIN * MININSEC)
+#define DAYLEN(date) (date_sec_change((date), 0, 1) - (date))
#define HOURINSEC (HOURINMIN * MININSEC)
#define MAXDAYSPERMONTH 31
diff --git a/src/day.c b/src/day.c
index 3e8adbf..dd93b53 100644
--- a/src/day.c
+++ b/src/day.c
@@ -294,7 +294,7 @@ static int day_store_apoints(long date)
p.apt = apt;
- if (apt->start >= date + DAYINSEC)
+ if (apt->start >= date + DAYLEN(date))
break;
day_add_item(APPT, apt->start, p);
diff --git a/src/ui-calendar.c b/src/ui-calendar.c
index 7d464dd..a668efb 100644
--- a/src/ui-calendar.c
+++ b/src/ui-calendar.c
@@ -97,7 +97,7 @@ static void *ui_calendar_date_thread(void *arg)
time_t actual, tomorrow;
for (;;) {
- tomorrow = (time_t) (get_today() + DAYINSEC);
+ tomorrow = date2sec(today, 24, 0);
while ((actual = time(NULL)) < tomorrow)
sleep(tomorrow - actual);