-
Philip Withnall authored
In order to be able to test the scheduling of entries over time, we need to have control over time itself. Earlier versions of this patch implemented a flux capacitor and a suitable framework for getting the unit tests up to 88mph. However, that approach was found to be not maintainable long term, and was thrown in flames into a ravine. Instead, we factor out g_date_time_new_now_local() into a MwsClockSystem implementation of a new MwsClock interface. As well as getting the current time, the interface supports adding/removing ‘alarms’ for functions to be invoked at a certain wall clock time in future. The system implementation uses g_timeout_source_new_seconds() for this. MwsClock includes provisions for notifying consumers of the fact that the system time zone or system clock has changed, but these are not currently used. This commit, while touching an unholy number of lines of code, introduces no functional changes. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://phabricator.endlessm.com/T20423
dbcb20eb