Ported messages from gear racing controller
[apps/native/gear-racing-car.git] / inc / messages / clock.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _CLOCK_MONOTONIC_H
18 #define _CLOCK_MONOTONIC_H
19
20 #include <time.h>
21 #include <stdbool.h>
22
23 /**
24  * @brief Check if platform supports all required clock types
25  *
26  * @return true if supported, false otherwise.
27  */
28 bool clock_is_supported();
29
30 /**
31  * @brief Gets current time using monotonic clock
32  *
33  * @note the func will abort if monotonic clock is not supported.
34  * call @clock_is_supported beforehead to validate if platform
35  * supports all clock types.
36  *
37  * @return: seconds since unspecified time point.
38  */
39 float clock_monotonic_get();
40
41 /**
42  * @brief Gets current time using realtime clock
43  *
44  * @note the func will abort if realtime clock is not supported.
45  * call @clock_is_supported beforehead to validate if platform
46  * supports all clock types.
47  *
48  * @return: number of seconds since Epoch
49  */
50 time_t clock_realtime_get();
51
52 #endif