mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/cpp11_thread: Use ztimer64_usec instead of xtimer
This commit is contained in:
parent
8e7407e5f6
commit
4795965ac2
@ -1,7 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += cpp11-compat
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer64_usec
|
||||
USEMODULE += timex
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -1,3 +1,3 @@
|
||||
CONFIG_MODULE_CPP11-COMPAT=y
|
||||
CONFIG_MODULE_TIMEX=y
|
||||
CONFIG_MODULE_XTIMER=y
|
||||
CONFIG_ZTIMER64_USEC=y
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <cstdio>
|
||||
#include <system_error>
|
||||
|
||||
#include "timex.h"
|
||||
#include "ztimer64.h"
|
||||
#include "riot/mutex.hpp"
|
||||
#include "riot/chrono.hpp"
|
||||
#include "riot/thread.hpp"
|
||||
@ -123,9 +125,9 @@ int main() {
|
||||
puts("Testing sleep_for ...");
|
||||
{
|
||||
timex_t before, after;
|
||||
xtimer_now_timex(&before);
|
||||
before = timex_from_uint64(ztimer64_now(ZTIMER64_USEC));
|
||||
this_thread::sleep_for(chrono::seconds(1));
|
||||
xtimer_now_timex(&after);
|
||||
after = timex_from_uint64(ztimer64_now(ZTIMER64_USEC));
|
||||
auto diff = timex_sub(after, before);
|
||||
expect(diff.seconds >= 1);
|
||||
}
|
||||
@ -136,9 +138,9 @@ int main() {
|
||||
puts("Testing sleep_until ...");
|
||||
{
|
||||
timex_t before, after;
|
||||
xtimer_now_timex(&before);
|
||||
before = timex_from_uint64(ztimer64_now(ZTIMER64_USEC));
|
||||
this_thread::sleep_until(riot::now() += chrono::seconds(1));
|
||||
xtimer_now_timex(&after);
|
||||
after = timex_from_uint64(ztimer64_now(ZTIMER64_USEC));
|
||||
auto diff = timex_sub(after, before);
|
||||
expect(diff.seconds >= 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user