time_util.h
Go to the documentation of this file.
1 /* Copyright (C) 2013-2016, The Regents of The University of Michigan.
2 All rights reserved.
3 
4 This software was developed in the APRIL Robotics Lab under the
5 direction of Edwin Olson, ebolson@umich.edu. This software may be
6 available under alternative licensing terms; contact the address above.
7 
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 
11 1. Redistributions of source code must retain the above copyright notice, this
12  list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 The views and conclusions contained in the software and documentation are those
29 of the authors and should not be interpreted as representing official policies,
30 either expressed or implied, of the Regents of The University of Michigan.
31 */
32 
33 #ifndef _TIME_UTIL_H
34 #define _TIME_UTIL_H
35 
36 #include <stdbool.h>
37 #include <stdint.h>
38 #include <sys/time.h>
39 #include <time.h>
40 #include <unistd.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
49 
50 int64_t utime_now(); // blacklist-ignore
51 int64_t utime_get_seconds(int64_t v);
52 int64_t utime_get_useconds(int64_t v);
53 void utime_to_timeval(int64_t v, struct timeval *tv);
54 void utime_to_timespec(int64_t v, struct timespec *ts);
55 
56 int32_t timeutil_usleep(int64_t useconds);
57 uint32_t timeutil_sleep(unsigned int seconds);
58 int32_t timeutil_sleep_hz(timeutil_rest_t *rest, double hz);
59 
63 bool timeutil_timer_timeout(timeutil_rest_t *rest, double timeout_s);
64 
65 int64_t time_util_hhmmss_ss_to_utime(double time);
66 
67 
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
uint32_t timeutil_sleep(unsigned int seconds)
Definition: time_util.c:90
timeutil_rest_t * timeutil_rest_create()
Definition: time_util.c:43
int32_t timeutil_sleep_hz(timeutil_rest_t *rest, double hz)
Definition: time_util.c:96
void timeutil_timer_reset(timeutil_rest_t *rest)
Definition: time_util.c:110
void utime_to_timeval(int64_t v, struct timeval *tv)
Definition: time_util.c:71
int64_t time_util_hhmmss_ss_to_utime(double time)
Definition: time_util.c:135
bool timeutil_timer_timeout(timeutil_rest_t *rest, double timeout_s)
Definition: time_util.c:129
void timeutil_rest_destroy(timeutil_rest_t *rest)
Definition: time_util.c:49
void timeutil_timer_stop(timeutil_rest_t *rest)
Definition: time_util.c:121
int32_t timeutil_usleep(int64_t useconds)
Definition: time_util.c:83
int64_t utime_get_useconds(int64_t v)
Definition: time_util.c:66
int64_t utime_get_seconds(int64_t v)
Definition: time_util.c:61
int64_t utime_now()
Definition: time_util.c:54
void utime_to_timespec(int64_t v, struct timespec *ts)
Definition: time_util.c:77
void timeutil_timer_start(timeutil_rest_t *rest)
Definition: time_util.c:116


apriltags2
Author(s): Danylo Malyuta
autogenerated on Fri Oct 19 2018 04:02:32