summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-12-02 11:00:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-09 10:37:51 +0100
commit89277e10682c76403321968af2dbe3f6e44409c8 (patch)
treed9a3a713c6119b33ddbf881f1b09c8b563c5526f
parente08b68d66f0d329028cd26849b99a824629d7863 (diff)
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>
-rw-r--r--src/corelib/kernel/qcore_unix_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index 8c0589fdc6..7ab632d7a0 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -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;