2016-06-15 23:48:41 +02:00
|
|
|
#ifndef TIMEVALOPERATIONS_H_
|
|
|
|
#define TIMEVALOPERATIONS_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-12-20 15:32:03 +01:00
|
|
|
|
|
|
|
#ifdef WIN32
|
2020-12-21 13:52:41 +01:00
|
|
|
#include <winsock2.h>
|
2020-12-20 15:32:03 +01:00
|
|
|
#else
|
2016-06-15 23:48:41 +02:00
|
|
|
#include <sys/time.h>
|
2020-12-20 15:32:03 +01:00
|
|
|
#endif
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
timeval& operator+=(timeval& lhs, const timeval& rhs);
|
|
|
|
|
|
|
|
timeval operator+(timeval lhs, const timeval& rhs);
|
|
|
|
|
|
|
|
timeval& operator-=(timeval& lhs, const timeval& rhs);
|
|
|
|
|
|
|
|
timeval operator-(timeval lhs, const timeval& rhs);
|
|
|
|
|
|
|
|
double operator/(const timeval& lhs, const timeval& rhs);
|
|
|
|
|
|
|
|
timeval& operator/=(timeval& lhs, double scalar);
|
|
|
|
|
|
|
|
timeval operator/(timeval lhs, double scalar);
|
|
|
|
|
|
|
|
timeval& operator*=(timeval& lhs, double scalar);
|
|
|
|
|
|
|
|
timeval operator*(timeval lhs, double scalar);
|
|
|
|
|
|
|
|
timeval operator*(double scalar, timeval rhs);
|
|
|
|
|
|
|
|
bool operator==(const timeval& lhs, const timeval& rhs);
|
|
|
|
bool operator!=(const timeval& lhs, const timeval& rhs);
|
|
|
|
bool operator<(const timeval& lhs, const timeval& rhs);
|
|
|
|
bool operator>(const timeval& lhs, const timeval& rhs);
|
|
|
|
bool operator<=(const timeval& lhs, const timeval& rhs);
|
|
|
|
bool operator>=(const timeval& lhs, const timeval& rhs);
|
|
|
|
|
|
|
|
namespace timevalOperations {
|
2018-07-12 16:29:32 +02:00
|
|
|
/**
|
|
|
|
* returns the seconds and subseconds stored in the timeval
|
|
|
|
* as double [s]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param timeval
|
|
|
|
* @return seconds
|
|
|
|
*/
|
2016-06-15 23:48:41 +02:00
|
|
|
double toDouble(const timeval timeval);
|
2020-08-28 17:14:20 +02:00
|
|
|
timeval toTimeval(const double seconds);
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TIMEVALOPERATIONS_H_ */
|