I searched through the systemd codebase and found that they use this call to set up a file_descriptor that can be monitored for jumps between the system time and the monotonic time.
http://linux.die.net/man/2/timerfd_create You can look up the "manger.c" file in the systemd codebase and look at the manager_setup_time_change() function (line 252) to see what they are doing http://cgit.freedesktop.org/systemd/systemd/tree/src/core/manager.c --- So basically instead of hooking into systemd, you can implement your own little program that sets up an FD, and does a select() on it, then use timerfd_gettime(). let me know if this works, as I only did research and didn't write up any code *.* On Friday, November 29, 2013 3:02:03 PM UTC-5, [email protected] wrote: > > Hello, > > I would like to know how to intercept the time change event in systemd. > > > with > > journalctl --since="today" > > I could see that systemd call some services when time is set: > > Jan 01 01:00:43 beaglebone connmand[128]: ntp: time slew +439068426.471130 s > . . . > Nov 29 20:27:50 beaglebone systemd[1]: Time has been changed > Nov 29 20:27:50 beaglebone systemd[1]: cpu-ondemand.timer: time change, > recalculating next elapse. > Nov 29 20:27:50 beaglebone systemd[1]: systemd-tmpfiles-clean.timer: time > change, recalculating next elapse. > Nov 29 20:27:50 beaglebone connmand[128]: connmand[128]: Setting hostname to > beaglebone > . . . > > How to add new services on time change ? I would like to set a hardware clock > automatically. > > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
