YARP
Yet Another Robot Platform
SystemClock.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3
* All rights reserved.
4
*
5
* This software may be modified and distributed under the terms of the
6
* BSD-3-Clause license. See the accompanying LICENSE file for details.
7
*/
8
9
#include <
yarp/conf/system.h
>
10
11
#include <
yarp/os/SystemClock.h
>
12
13
#include <chrono>
14
#include <thread>
15
16
17
double
yarp::os::SystemClock::now
()
18
{
19
return
nowSystem
();
20
}
21
22
void
yarp::os::SystemClock::delay
(
double
seconds)
23
{
24
delaySystem(seconds);
25
}
26
27
bool
yarp::os::SystemClock::isValid
()
const
28
{
29
return
true
;
30
}
31
32
void
yarp::os::SystemClock::delaySystem
(
double
seconds)
33
{
34
std::this_thread::sleep_for(std::chrono::duration<double>(seconds));
35
}
36
37
double
yarp::os::SystemClock::nowSystem
()
38
{
39
return
std::chrono::time_point_cast<std::chrono::duration<double>>(
std::chrono::high_resolution_clock::now
()).time_since_epoch().count();
40
}
SystemClock.h
yarp::os::Time::now
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition:
Time.cpp:124
yarp::os::SystemClock::nowSystem
static double nowSystem()
Definition:
SystemClock.cpp:37
yarp::os::SystemClock::now
double now() override
Return the current time in seconds, relative to an arbitrary starting point.
Definition:
SystemClock.cpp:17
yarp::os::SystemClock::delaySystem
static void delaySystem(double seconds)
Definition:
SystemClock.cpp:32
yarp::os::SystemClock::delay
void delay(double seconds) override
Wait for a certain number of seconds.
Definition:
SystemClock.cpp:22
system.h
yarp::os::SystemClock::isValid
bool isValid() const override
Check if time is valid (non-zero).
Definition:
SystemClock.cpp:27
YARP
3.4.100+20201223.2+gitb8ea4d712
src
libYARP_os
src
yarp
os
SystemClock.cpp
Generated on Sun Jan 3 2021 02:46:25 for YARP by
1.8.20