Skip to content

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

Open
@n-schwellnus

Description

@n-schwellnus

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions