YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
controlClock.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include "controlClock.h"
7#include <yarp/os/Time.h>
8
10{
11 if (running)
12 {
13 return elapsedTime + (yarp::os::Time::now() - startTime);
14 }
15 return elapsedTime;
16}
17
19{
20 if (!running)
21 {
22 startTime = yarp::os::Time::now();
23 running = true;
24 }
25}
26
28{
29 if (running)
30 {
31 elapsedTime += (yarp::os::Time::now() - startTime);
32 running = false;
33 }
34}
36{
37 running = false;
38 startTime = 0.0;
39 elapsedTime = 0.0;
40}
double getElapsedTime()
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition Time.cpp:121