uint64_t now_mono_time(void);
uint64_t now_cpu_time(void);
void clock_set_local_source(void);
-void clock_update_date(int max_wait, int interrupted);
+void clock_update_local_date(int max_wait, int interrupted);
+void clock_update_global_date();
void clock_init_process_date(void);
void clock_init_thread_date(void);
int clock_setup_signal_timer(void *timer, int sig, int val);
void clock_leaving_poll(int timeout, int interrupted);
void clock_entering_poll(void);
+static inline void clock_update_date(int max_wait, int interrupted)
+{
+ clock_update_local_date(max_wait, interrupted);
+ clock_update_global_date();
+}
+
#endif
* values for the tv_sec and tv_usec parts. The offset is made of two signed
* ints so that the clock can be adjusted in the two directions.
*/
-void clock_update_date(int max_wait, int interrupted)
+void clock_update_local_date(int max_wait, int interrupted)
{
- struct timeval min_deadline, max_deadline, tmp_now;
- uint old_now_ms;
- ullong old_now;
- ullong new_now;
- ullong ofs, ofs_new;
- uint sec_ofs, usec_ofs;
+ struct timeval min_deadline, max_deadline;
+ ullong ofs;
gettimeofday(&date, NULL);
now.tv_sec += 1;
}
}
+ now_ms = __tv_to_ms(&now);
+}
+
+void clock_update_global_date()
+{
+ struct timeval tmp_now;
+ uint old_now_ms;
+ ullong old_now;
+ ullong new_now;
+ ullong ofs, ofs_new;
+ uint sec_ofs, usec_ofs;
+
+ ofs = HA_ATOMIC_LOAD(&now_offset);
/* now that we have bounded the local time, let's check if it's
* realistic regarding the global date, which only moves forward,