Add operator!=() for timespec structs.

This is not an attempt to complete this API, but rather preventing code
like !(a==b) being used every time timespec structs are compared for
unequality.

Change-Id: I0edf3fd3c44a9350208adc6b3fb5fe8aec370a45
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Erik Verbruggen 2013-12-02 11:00:07 +01:00 committed by The Qt Project
parent e08b68d66f
commit 89277e1068

View File

@ -117,6 +117,8 @@ inline bool operator<(const timespec &t1, const timespec &t2)
{ return t1.tv_sec < t2.tv_sec || (t1.tv_sec == t2.tv_sec && t1.tv_nsec < t2.tv_nsec); }
inline bool operator==(const timespec &t1, const timespec &t2)
{ return t1.tv_sec == t2.tv_sec && t1.tv_nsec == t2.tv_nsec; }
inline bool operator!=(const timespec &t1, const timespec &t2)
{ return !(t1 == t2); }
inline timespec &operator+=(timespec &t1, const timespec &t2)
{
t1.tv_sec += t2.tv_sec;