Clock::~Clock() {
}
+
+utime_t Clock::now() {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ utime_t n(&tv);
+ n += g_conf.clock_offset;
+ if (n < last) {
+ //derr << "WARNING: clock jumped backwards from " << last << " to " << n << dendl;
+ n = last; // clock jumped backwards!
+ } else
+ last = n;
+ return n;
+}
Clock();
~Clock();
- utime_t now() {
- struct timeval tv;
- gettimeofday(&tv, NULL);
- utime_t n(&tv);
- if (n < last) {
- //derr << "WARNING: clock jumped backwards from " << last << " to " << n << dendl;
- n = last; // clock jumped backwards!
- } else
- last = n;
- return n;
- }
+ utime_t now();
utime_t recent_now() {
return last;
time_t gettime() {
return now().sec();
}
-
};
extern Clock g_clock;
OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0), // gather updates for this long before proposing a map update
OPTION(paxos_min_wait, OPT_DOUBLE, 0.05), // min time to gather updates for after period of inactivity
OPTION(paxos_observer_timeout, OPT_DOUBLE, 5*60), // gather updates for this long before proposing a map update
+ OPTION(clock_offset, OPT_DOUBLE, 0), // how much to offset the system clock by with g_clock
OPTION(auth_supported, OPT_STR, "none"),
OPTION(auth_mon_ticket_ttl, OPT_DOUBLE, 60*60*12),
OPTION(auth_service_ticket_ttl, OPT_DOUBLE, 60*60),