aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-09 08:44:05 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-09 08:44:05 +0800
commit47ff8cbbb25a28197c38d2ae6272e404d45a577d (patch)
tree0c601b453acbe34fc92c4e8757f68c3e10741e81 /src
parentfb3d5903b4fac8d6b3aeca0f652af2c419c4fc02 (diff)
downloadgsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.tar
gsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.tar.gz
gsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.tar.bz2
gsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.tar.lz
gsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.tar.xz
gsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.tar.zst
gsoc2013-epiphany-47ff8cbbb25a28197c38d2ae6272e404d45a577d.zip
Make it also correct on DST changes.
2004-11-09 Christian Persch <chpe@cvs.gnome.org> * src/ephy-history-window.c: (add_by_date_filter): Make it also correct on DST changes.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-history-window.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index daf45fa87..ac56df46f 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -824,9 +824,6 @@ add_by_site_filter (EphyHistoryWindow *editor, EphyNodeFilter *filter, int level
level);
}
-#define SEC_PER_DAY (60 * 60 * 24)
-#include "time.h"
-
static void
add_by_date_filter (EphyHistoryWindow *editor,
EphyNodeFilter *filter,
@@ -852,21 +849,32 @@ add_by_date_filter (EphyHistoryWindow *editor,
btime.tm_hour = 0;
midnight = mktime (&btime);
- /* FIXME: take switches from/to DST into account! */
switch (time_range)
{
case TIME_LAST_HALF_HOUR:
cmp_time = now - 30 * 60;
break;
+ case TIME_LAST_THREE_DAYS:
+ /* subtract 1 day */
+ midnight -= 43200;
+ localtime_r (&midnight, &btime);
+ btime.tm_sec = 0;
+ btime.tm_min = 0;
+ btime.tm_hour = 0;
+ midnight = mktime (&btime);
+ /* fall-through */
+ case TIME_LAST_TWO_DAYS:
+ /* subtract 1 day */
+ midnight -= 43200;
+ localtime_r (&midnight, &btime);
+ btime.tm_sec = 0;
+ btime.tm_min = 0;
+ btime.tm_hour = 0;
+ midnight = mktime (&btime);
+ /* fall-through */
case TIME_TODAY:
cmp_time = midnight;
break;
- case TIME_LAST_TWO_DAYS:
- cmp_time = midnight - SEC_PER_DAY;
- break;
- case TIME_LAST_THREE_DAYS:
- cmp_time = midnight - 2 * SEC_PER_DAY;
- break;
default:
g_return_if_reached ();
break;