• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef TIMER_CLOCK_ID
17 #define TIMER_CLOCK_ID
18 
19 #include <time.h>
20 #include <gtest/gtest.h>
21 
22 // defined in musl/include/time.h
23 static const char* ALL_CLOCKS_NAME[CLOCK_TAI + 1] = {
24     "CLOCK_REALTIME",
25     "CLOCK_MONOTONIC",
26     "CLOCK_PROCESS_CPUTIME_ID",
27     "CLOCK_THREAD_CPUTIME_ID",
28     "CLOCK_MONOTONIC_RAW",
29     "CLOCK_REALTIME_COARSE",
30     "CLOCK_MONOTONIC_COARSE",
31     "CLOCK_BOOTTIME",
32     "CLOCK_REALTIME_ALARM",
33     "CLOCK_BOOTTIME_ALARM",
34     "CLOCK_SGI_CYCLE",
35     "CLOCK_TAI",
36 };
37 
38 static const auto ALL_CLOCK_IDS = testing::Values(CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID,
39     CLOCK_THREAD_CPUTIME_ID, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE,
40     CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM, CLOCK_BOOTTIME_ALARM, CLOCK_SGI_CYCLE, CLOCK_TAI);
41 
42 static const auto ALL_SUPPORTED_IDS = testing::Values(CLOCK_MONOTONIC, CLOCK_REALTIME,
43     CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_RAW);
44 
45 class AllClockIDTest : public testing::TestWithParam<int> {
46 };
47 class SupportedClockIDTest : public testing::TestWithParam<int> {
48 };
49 
50 #endif