IncludeOS
IncludeOS copied to clipboard
RTC::now() [__arch_wall_clock()] always returns boot time
When I run IncludeOS on qemu and use RTC::now() the time returned is always the boot time, it seems like __arch_wall_clock() is not updating either tv_sec or tv_nsec. __arch_system_time() does return incrementing values. Am I doing something wrong here? What can I do to further debug the issue?
#include <os>
#include <timers>
#include <ctime>
#include <rtc>
void Service::start()
{
Timers::periodic(std::chrono::seconds(1), std::chrono::seconds(1),
[] (uint32_t) {
printf("RTC::now %lu\n", RTC::now());
printf("RTC::boot_timestamp %lu\n", RTC::boot_timestamp());
printf("RTC::nanos_now %lu\n", RTC::nanos_now());
printf("arch_wall_clock().tv_sec %lu\n", __arch_wall_clock().tv_sec);
printf("arch_wall_clock().tv_nsec %lu\n", __arch_wall_clock().tv_nsec);
printf("ctime %lu\n", time(0));
});
}
RTC::now 1560874705
RTC::boot_timestamp 1560874705
RTC::nanos_now 2619881656
arch_wall_clock().tv_sec 1560874705
arch_wall_clock().tv_nsec 425276046
ctime 1560874705
RTC::now 1560874705
RTC::boot_timestamp 1560874705
RTC::nanos_now 3620018470
arch_wall_clock().tv_sec 1560874705
arch_wall_clock().tv_nsec 425276046
ctime 1560874705
RTC::now 1560874705
RTC::boot_timestamp 1560874705
RTC::nanos_now 4620212259
arch_wall_clock().tv_sec 1560874705
arch_wall_clock().tv_nsec 425276046
ctime 1560874705
That's definitely a problem. So, you can probably fix this temporarily by disabling KVM clocks, probably from clocks.cpp in that x86 platform folder. Updating the OS is not easy now though, as you need to put the OS into editable mode since we are using Conan now.
The plan is to just disable KVM clocks (again). Until the problem with them is solved.