aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-02-07 08:14:03 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-02-07 08:14:03 +0000
commit5aaeebde0bfb74505e5b669a41079d3efd4afc69 (patch)
tree41e0cf519971e9703a141d8dca86a73e6a2d443b
parent3851bd2ba3e6756b0786a977e7acd4445d9600e1 (diff)
downloadenlightenment-5aaeebde0bfb74505e5b669a41079d3efd4afc69.tar.gz
enlightenment-5aaeebde0bfb74505e5b669a41079d3efd4afc69.tar.xz
enlightenment-5aaeebde0bfb74505e5b669a41079d3efd4afc69.zip
fix/improve clock module date/time change detection. :)
SVN revision: 83717
-rw-r--r--ChangeLog5
-rw-r--r--NEWS2
-rw-r--r--src/modules/clock/e_mod_main.c45
3 files changed, 39 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 36649b672..f355968e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-07 Carsten Haitzler
+
+ * fix clock timerfd usage to actually detect a date change.
+ * improve clock to also listen to /etc/timezone changes too.
+
2013-02-06 Mike Blumenkrantz
* added api to automatically disable widgets when checkboxes are checked or unchecked
diff --git a/NEWS b/NEWS
index 728050ef2..9e8d82ca7 100644
--- a/NEWS
+++ b/NEWS
@@ -94,6 +94,7 @@ Improvements:
* improve load time of apps dialogs
* new tab in focus settings for pointer warping
* unify all pointer warp animators
+ * clock listens to /etc/timezone changes now too
Fixes:
* IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar.
@@ -156,3 +157,4 @@ Fixes:
* fix bug where edge flips would stop functioning after dragging to an invalid edge containing a shelf
* moved "allow windows above fullscreen windows" option to geometry settings dialog
* fix filemanager efreet cache listeners and updates
+ * fix clock timerfd usage to actually detect date changes
diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c
index 44fa483ce..11ee509e9 100644
--- a/src/modules/clock/e_mod_main.c
+++ b/src/modules/clock/e_mod_main.c
@@ -40,6 +40,7 @@ static Config_Item *_conf_item_get(const char *id);
static void _clock_popup_free(Instance *inst);
static Eio_Monitor *clock_tz_monitor = NULL;
+static Eio_Monitor *clock_tz2_monitor = NULL;
static Eina_List *clock_eio_handlers = NULL;
Config *clock_config = NULL;
@@ -805,6 +806,8 @@ _clock_eio_error(void *d __UNUSED__, int type __UNUSED__, void *event __UNUSED__
{
eio_monitor_del(clock_tz_monitor);
clock_tz_monitor = eio_monitor_add("/etc/localtime");
+ eio_monitor_del(clock_tz2_monitor);
+ clock_tz2_monitor = eio_monitor_add("/etc/timezone");
return ECORE_CALLBACK_RENEW;
}
@@ -869,6 +872,7 @@ e_modapi_init(E_Module *m)
clock_config->module = m;
clock_tz_monitor = eio_monitor_add("/etc/localtime");
+ clock_tz2_monitor = eio_monitor_add("/etc/timezone");
E_LIST_HANDLER_APPEND(clock_eio_handlers, EIO_MONITOR_ERROR, _clock_eio_error, NULL);
E_LIST_HANDLER_APPEND(clock_eio_handlers, EIO_MONITOR_FILE_CREATED, _clock_eio_update, NULL);
E_LIST_HANDLER_APPEND(clock_eio_handlers, EIO_MONITOR_FILE_MODIFIED, _clock_eio_update, NULL);
@@ -880,19 +884,32 @@ e_modapi_init(E_Module *m)
e_gadcon_provider_register(&_gadcon_class);
#ifdef HAVE_SYS_TIMERFD_H
- int timer_fd;
- int flags;
-
- /* on old systems, flags must be 0, so we'll play nice and do it always */
- timer_fd = timerfd_create(CLOCK_REALTIME, 0);
- if (timer_fd < 0) return m;
- fcntl(timer_fd, F_SETFL, O_NONBLOCK);
-
- flags = fcntl(timer_fd, F_GETFD);
- flags |= FD_CLOEXEC;
- fcntl(timer_fd, F_SETFD, flags);
-
- timerfd_handler = ecore_main_fd_handler_add(timer_fd, ECORE_FD_READ, _clock_fd_update, NULL, NULL, NULL);
+
+#ifndef TFD_TIMER_CANCELON_SET
+# define TFD_TIMER_CANCELON_SET (1 << 1)
+#endif
+ {
+ int timer_fd;
+ int flags;
+ struct itimerspec its;
+
+ // on old systems, flags must be 0, so we'll play nice and do it always
+ timer_fd = timerfd_create(CLOCK_REALTIME, 0);
+ if (timer_fd < 0) return m;
+ fcntl(timer_fd, F_SETFL, O_NONBLOCK);
+
+ flags = fcntl(timer_fd, F_GETFD);
+ flags |= FD_CLOEXEC;
+ fcntl(timer_fd, F_SETFD, flags);
+
+ memset(&its, 0, sizeof(its));
+ timerfd_settime(timer_fd, TFD_TIMER_ABSTIME | TFD_TIMER_CANCELON_SET,
+ &its, NULL);
+
+ timerfd_handler = ecore_main_fd_handler_add(timer_fd, ECORE_FD_READ,
+ _clock_fd_update, NULL,
+ NULL, NULL);
+ }
#endif
return m;
}
@@ -935,7 +952,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
update_today = NULL;
}
eio_monitor_del(clock_tz_monitor);
+ eio_monitor_del(clock_tz2_monitor);
clock_tz_monitor = NULL;
+ clock_tz2_monitor = NULL;
#ifdef HAVE_SYS_TIMERFD_H
timerfd_handler = ecore_main_fd_handler_del(timerfd_handler);
#endif