#include "util.h"
#include "strv.h"
#include "def.h"
-#include "hwclock.h"
+#include "clock-util.h"
#include "conf-files.h"
#include "path-util.h"
#include "fileio-label.h"
c->zone = NULL;
}
- c->local_rtc = hwclock_is_localtime() > 0;
+ c->local_rtc = clock_is_localtime() > 0;
return 0;
}
int r;
zero(tm);
- r = hwclock_get_time(&tm);
+ r = clock_get_time(&tm);
if (r == -EBUSY) {
log_warning("/dev/rtc is busy. Is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp.");
t = 0;
}
/* 2. Tell the kernel our timezone */
- hwclock_set_timezone(NULL);
+ clock_set_timezone(NULL);
if (c->local_rtc) {
struct timespec ts;
/* 3. Sync RTC from system clock, with the new delta */
assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
assert_se(tm = localtime(&ts.tv_sec));
- hwclock_set_time(tm);
+ clock_set_time(tm);
}
log_struct(LOG_INFO,
}
/* 2. Tell the kernel our timezone */
- hwclock_set_timezone(NULL);
+ clock_set_timezone(NULL);
/* 3. Synchronize clocks */
assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
/* Override the main fields of
* struct tm, but not the timezone
* fields */
- if (hwclock_get_time(&tm) >= 0) {
+ if (clock_get_time(&tm) >= 0) {
/* And set the system clock
* with this */
else
tm = gmtime(&ts.tv_sec);
- hwclock_set_time(tm);
+ clock_set_time(tm);
}
log_info("RTC configured to %s time.", c->local_rtc ? "local" : "UTC");
else
tm = gmtime(&ts.tv_sec);
- hwclock_set_time(tm);
+ clock_set_time(tm);
log_struct(LOG_INFO,
MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
- "REALTIME=%llu", (unsigned long long) timespec_load(&ts),
+ "REALTIME="USEC_FMT, timespec_load(&ts),
"MESSAGE=Changed local time to %s", ctime(&ts.tv_sec),
NULL);
return r;
}
- r = sd_bus_add_object_vtable(bus, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", timedate_vtable, c);
+ r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", timedate_vtable, c);
if (r < 0) {
log_error("Failed to register object: %s", strerror(-r));
return r;