42 explicit TimeSpec(
const timespec& ts);
62 TimeSpec& operator=(
const timespec& ts);
72 explicit operator bool()
const;
82 bool operator>=(
const timespec& ts)
const;
87 bool operator>(
const timespec& ts)
const;
92 bool operator<(
const timespec& ts)
const;
97 bool operator<=(
const timespec& ts)
const;
107 bool operator!=(
const timespec& ts)
const;
256 : timespec{sec, nano_sec}
266 return tv_sec || tv_nsec;
269inline TimeSpec::operator bool()
const
271 return tv_sec || tv_nsec;
317 return add(0, nano_sec);
322 return add(0, -nano_sec);
sf::TimeSpec operator+(const timespec &lhs, const timespec &rhs)
Addition operator for std::timespec types which also work for sf::TimeSpec.
Definition TimeSpec.h:353
std::ostream & operator<<(std::ostream &os, const sf::TimeSpec &ts)
Operator for writing the sf::TimeSpec to an output-stream.
Definition TimeSpec.h:376
sf::TimeSpec operator-(const timespec &lhs, const timespec &rhs)
Subtraction operator for std::timespec types which also work for sf::TimeSpec.
Definition TimeSpec.h:364
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10
_MISC_FUNC int timespecCompare(const timespec &ts1, const timespec &ts2)
Compares the 2 'timespec' time structures. Helper function.
_MISC_FUNC bool operator==(const Md5Hash::hash_type &h1, const Md5Hash::hash_type &h2)
Compare operator for storing an MD5 hash.
bool isZero(T value, T epsilon=std::numeric_limits< T >::epsilon())
Check if the passed value is zero or near zero according the given epsilon.
Definition misc/gen/math.h:263
QRect operator+=(QRect &rc, const QPoint &pt)
Allows adjusting the QRect position using a QPoint.
Definition qt_utils.h:69
QRect operator-=(QRect &rc, const QPoint &pt)
Allows adjusting the QRect position using a QPoint.
Definition qt_utils.h:86
Class wrapper for timespec structure to modify.
Definition TimeSpec.h:12
TimeSpec operator-(const timespec &t) const
Operator to add another timespec.
Definition TimeSpec.h:340
TimeSpec & assign(const timespec &ts)
Assigns a timespec base type.
TimeSpec & assign(time_t sec, nsec_type nano_sec)
Assigns seconds and nanoseconds to the current value.
void clear()
clear this instance.
Definition TimeSpec.h:274
bool operator>=(const timespec &ts) const
Compare operator.
Definition TimeSpec.h:280
TimeSpec()
Default constructor.
Definition TimeSpec.h:235
TimeSpec & operator=(TimeSpec &&)=default
Move assignment operator is default.
TimeSpec operator+(const timespec &t) const
Operator to add another timespec.
Definition TimeSpec.h:335
bool operator==(const timespec &ts) const
Compare operator.
Definition TimeSpec.h:300
std::string toString() const
Gets the time as toDouble() result converted to a string.
TimeSpec & randomize(double factor=0.1)
Modifies the current value using the passed factor where 0.1 is + or - 10%.
bool operator<(const timespec &ts) const
Compare operator.
Definition TimeSpec.h:290
TimeSpec & setTimeOfDay()
assign the current time.
double toDouble() const
Gets the time value as a double.
bool isZero() const
Test if it has been set and thus not-zero.
Definition TimeSpec.h:264
bool operator>(const timespec &ts) const
Compare operator.
Definition TimeSpec.h:285
TimeSpec & operator+=(nsec_type nano_sec)
Operator to add nanoseconds.
Definition TimeSpec.h:315
TimeSpec & add(time_t sec, nsec_type nano_sec)
Adds seconds and nanoseconds to the current value.
TimeSpec & operator-=(nsec_type nano_sec)
Operator to add nanoseconds.
Definition TimeSpec.h:320
bool operator!=(const timespec &ts) const
Compare operator.
Definition TimeSpec.h:305
long nsec_type
Integer type to indicate nanoseconds.
Definition TimeSpec.h:17
time_t toMilliSecs() const
Gets the time value as a double.
bool operator<=(const timespec &ts) const
Compare operator.
Definition TimeSpec.h:295
TimeSpec & add(const timespec &ts)
Adds a timespec base type to the current value.
TimeSpec & assign(double sec)
Assigns a double as seconds.
TimeSpec(TimeSpec &&ts)=default
Move constructor.
TimeSpec & sub(const timespec &ts)
Subtracts a timespec base type from the current value.