TimeStamp.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _TimeStamp_H
19 #define _TimeStamp_H
20 
21 #include <time.h>
22 
23 //-------------------------------------------------------------------
24 
25 
31 class TimeStamp
32 {
33 public:
35  TimeStamp();
36 
38  virtual ~TimeStamp() {};
39 
41  void SetNow();
42 
44  double operator-(const TimeStamp& EarlierTime) const;
45 
47 
49  void operator+=(double TimeS);
50 
52 
54  void operator-=(double TimeS);
55 
57  bool operator>(const TimeStamp& Time);
58 
60  bool operator<(const TimeStamp& Time);
61 
65  void getTimeStamp(long& lSeconds, long& lNanoSeconds);
66 
70  void setTimeStamp(const long& lSeconds, const long& lNanoSeconds);
71 
72 
73 protected:
74 
76  timespec m_TimeStamp;
77 
78 private:
79 
81  static double TimespecToDouble(const ::timespec& LargeInt);
82 
84  static ::timespec DoubleToTimespec(double TimeS);
85 
86 };
87 
88 #endif
void setTimeStamp(const long &lSeconds, const long &lNanoSeconds)
Definition: TimeStamp.cpp:115
timespec m_TimeStamp
Internal time stamp data.
Definition: TimeStamp.h:76
void operator-=(double TimeS)
Reduces the timestamp by TimeS seconds.
Definition: TimeStamp.cpp:81
void getTimeStamp(long &lSeconds, long &lNanoSeconds)
Definition: TimeStamp.cpp:109
void SetNow()
Makes time measurement.
Definition: TimeStamp.cpp:27
TimeStamp()
Constructor.
Definition: TimeStamp.cpp:21
void operator+=(double TimeS)
Increase the timestamp by TimeS seconds.
Definition: TimeStamp.cpp:69
bool operator>(const TimeStamp &Time)
Checks if this time is after time "Time".
Definition: TimeStamp.cpp:93
bool operator<(const TimeStamp &Time)
Checks if this time is before time "Time".
Definition: TimeStamp.cpp:101
double operator-(const TimeStamp &EarlierTime) const
Retrieves time difference in seconds.
Definition: TimeStamp.cpp:54
virtual ~TimeStamp()
Destructor.
Definition: TimeStamp.h:38
static double TimespecToDouble(const ::timespec &LargeInt)
Conversion timespec -> double.
Definition: TimeStamp.cpp:32
::timespec DoubleToTimespec(double TimeS)
Conversion double -> timespec.
Definition: TimeStamp.cpp:37


cob_trajectory_controller
Author(s): Alexander Bubeck
autogenerated on Thu Apr 8 2021 02:39:55