Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTC::now() [__arch_wall_clock()] always returns boot time #2174

Open
n-schwellnus opened this issue Jun 18, 2019 · 2 comments
Open

RTC::now() [__arch_wall_clock()] always returns boot time #2174

n-schwellnus opened this issue Jun 18, 2019 · 2 comments

Comments

@n-schwellnus
Copy link

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
@fwsGonzo
Copy link
Member

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.

@fwsGonzo
Copy link
Member

The plan is to just disable KVM clocks (again). Until the problem with them is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants