YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
PlatformTime.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2011 Anne van Rossum <anne@almende.com>
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_IMPL_PLATFORMTIME_H
8#define YARP_OS_IMPL_PLATFORMTIME_H
9
10#include <yarp/conf/system.h>
11#ifdef YARP_HAS_ACE
12# include <ace/High_Res_Timer.h>
13# include <ace/OS_NS_sys_time.h>
14# include <ace/Time_Value.h>
15// In one the ACE headers there is a definition of "main" for WIN32
16# ifdef main
17# undef main
18# endif
19# define PLATFORM_TIME_SET(x, y) x.set(y)
20#else
21# include <sys/time.h>
22# define PLATFORM_TIME_SET(x, y) fromDouble(x, y)
23#endif
24
25namespace yarp::os::impl {
26
27#ifdef YARP_HAS_ACE
28typedef ACE_Time_Value YARP_timeval;
29#else
30typedef struct timeval YARP_timeval;
31#endif
32
33void getTime(YARP_timeval& now);
35void addTime(YARP_timeval& val, const YARP_timeval& add);
37 const YARP_timeval& subtract);
38double toDouble(const YARP_timeval& v);
39void fromDouble(YARP_timeval& v, double x, int unit = 1);
40
41} // namespace yarp::os::impl
42
43#endif // YARP_OS_IMPL_PLATFORMTIME_H
A mini-server for performing network communication in the background.
The components from which ports and connections are built.
void addTime(YARP_timeval &val, const YARP_timeval &add)
void getTime(YARP_timeval &now)
double toDouble(const YARP_timeval &v)
struct timeval YARP_timeval
void subtractTime(YARP_timeval &val, const YARP_timeval &subtract)
void sleepThread(YARP_timeval &sleep_period)
void fromDouble(YARP_timeval &v, double x, int unit=1)