blob: a88bd2fb857d18607632c9e20c3d030aab9ffa41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* @brief Tests for functions in libc++ (libcxx).
*/
#include "test_util.h"
extern "C" {
#include "timer.h"
}
#include <chrono>
static int test_system_clock()
{
auto start = std::chrono::system_clock::now();
udelay(0.5 * SECOND);
auto end = std::chrono::system_clock::now();
auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
end - start)
.count();
TEST_NEAR(elapsed_ms, 500ULL, 5ULL, "%llu");
return EC_SUCCESS;
}
extern "C" void run_test(int, const char **)
{
test_reset();
RUN_TEST(test_system_clock);
test_print_result();
}
|