diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-11-09 08:48:54 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-11-09 08:48:54 +0800 |
commit | 766288ae5afe2c72a574267cd656bb5dad3c5862 (patch) | |
tree | 2a00f97651e180ef91d5e3c24ebea6383436c86e /src/ephy-history-window.c | |
parent | e963dd81114ca2f531b9336ff4afe33de0ec8f5a (diff) | |
download | gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.tar gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.tar.gz gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.tar.bz2 gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.tar.lz gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.tar.xz gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.tar.zst gsoc2013-epiphany-766288ae5afe2c72a574267cd656bb5dad3c5862.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/ephy-history-window.c')
-rw-r--r-- | src/ephy-history-window.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 502dcbeb4..e14f8b975 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -878,9 +878,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, @@ -906,18 +903,29 @@ 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_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; + /* 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; default: g_return_if_reached (); break; |