rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
time.h
Go to the documentation of this file.
1 // Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 //
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 #ifndef RMW__TIME_H_
16 #define RMW__TIME_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif // __cplusplus
22 
23 #include <stdint.h>
24 
25 #include "rcutils/time.h"
26 
27 #include "rmw/macros.h"
28 #include "rmw/visibility_control.h"
29 
32 {
34  uint64_t sec;
35 
37  uint64_t nsec;
38 } rmw_time_t;
39 
42 
44 
54 #define RMW_DURATION_INFINITE {9223372036LL, 854775807LL}
55 #define RMW_DURATION_UNSPECIFIED {0LL, 0LL}
56 
60 bool
61 rmw_time_equal(const rmw_time_t left, const rmw_time_t right);
62 
64 
71 
73 
80 rmw_time_from_nsec(const rmw_duration_t nanoseconds);
81 
86 rmw_time_normalize(const rmw_time_t time);
87 
88 #ifdef __cplusplus
89 }
90 #endif // __cplusplus
91 
92 #endif // RMW__TIME_H_
rcutils_duration_value_t
int64_t rcutils_duration_value_t
rmw_duration_t
rcutils_duration_value_t rmw_duration_t
Definition: time.h:41
rmw_time_point_value_t
rcutils_time_point_value_t rmw_time_point_value_t
Definition: time.h:40
rmw_time_t::nsec
uint64_t nsec
Nanoseconds component.
Definition: time.h:37
RMW_PUBLIC
#define RMW_PUBLIC
Definition: visibility_control.h:48
rmw_time_t
A struct representing a duration or relative time in RMW - does not encode an origin.
Definition: time.h:31
rmw_time_normalize
rmw_time_t rmw_time_normalize(const rmw_time_t time)
Ensure that an rmw_time_t does not have nanoseconds > 1 second.
RMW_PUBLIC_TYPE
RMW_PUBLIC_TYPE
Type mapping of rcutils log severity types to rmw specific types.
Definition: types.h:540
time.h
rmw_time_from_nsec
rmw_time_t rmw_time_from_nsec(const rmw_duration_t nanoseconds)
Construct rmw_time_t from a total nanoseconds representation.
macros.h
RMW_WARN_UNUSED
#define RMW_WARN_UNUSED
Indicate that a variable is not used, and prevent compiler from issuing warnings.
Definition: macros.h:24
rmw_time_t
struct RMW_PUBLIC_TYPE rmw_time_t rmw_time_t
A struct representing a duration or relative time in RMW - does not encode an origin.
rmw_time_total_nsec
rmw_duration_t rmw_time_total_nsec(const rmw_time_t time)
Return the total nanosecond representation of a time.
rcutils_time_point_value_t
int64_t rcutils_time_point_value_t
rmw_time_t::sec
uint64_t sec
Seconds component.
Definition: time.h:34
visibility_control.h
rmw_time_equal
bool rmw_time_equal(const rmw_time_t left, const rmw_time_t right)
Check whether two rmw_time_t represent the same time.