RobotsIO
Loading...
Searching...
No Matches
ClockYarp.cpp
1/*
2 * Copyright (C) 2020 Istituto Italiano di Tecnologia (IIT)
3 *
4 * This software may be modified and distributed under the terms of the
5 * BSD 3-Clause license. See the accompanying LICENSE file for details.
6 */
7
8#include <RobotsIO/Utils/ClockYarp.h>
9
10#include <stdexcept>
11
12#include <yarp/os/Time.h>
13
14using namespace RobotsIO::Utils;
15
16
17ClockYarp::ClockYarp()
18{
19 if (!yarp_.checkNetwork())
20 {
21 throw(std::runtime_error(log_name_ + "::ctor. Error: YARP network is not available."));
22 }
23}
24
25
26ClockYarp::~ClockYarp()
27{}
28
29
30double ClockYarp::now() const
31{
32 return yarp::os::Time::now();
33}
34
35
36void ClockYarp::delay(const int& milliseconds) const
37{
38 return yarp::os::Time::delay(double(milliseconds) / 1000.0);
39}