From f7541d48074e6a44fb00050424d03ad922ebacb0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 5 Jun 2008 23:51:04 +0000 Subject: [PATCH] corrected bug in wxTimeSpan::IsShorterThan() for equal time spans (ticket #9539) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53988 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/datetime.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 4c271ac1db..c6df56c38b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -272,6 +272,7 @@ All: now thread-safe if the standard library provided with your compiler is. - Added wxCmdLineParser::AddUsageText() (Marcin 'Malcom' Malich). - Fix reading/writing UTF-7-encoded text streams. +- Corrected bug in wxTimeSpan::IsShorterThan() for equal time spans. All (Unix): diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 3fddea3f9a..45afb33748 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -1433,7 +1433,7 @@ public: // compare two timestamps: works with the absolute values, i.e. 1 // hour is shorter than -2 hours. Also, it will return false if the // timespans are equal in absolute value. - bool IsShorterThan(const wxTimeSpan& t) const { return !IsLongerThan(t); } + bool IsShorterThan(const wxTimeSpan& t) const; inline bool operator<(const wxTimeSpan &ts) const { @@ -2203,6 +2203,11 @@ inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const return GetValue().Abs() > ts.GetValue().Abs(); } +inline bool wxTimeSpan::IsShorterThan(const wxTimeSpan& ts) const +{ + return GetValue().Abs() < ts.GetValue().Abs(); +} + // ---------------------------------------------------------------------------- // wxDateSpan // ---------------------------------------------------------------------------- -- 2.45.2