[ wxwindows-Bugs-1771668 ] wxDateTime::Subtract is off by one hour

SourceForge.net noreply at sourceforge.net
Fri Aug 10 06:41:37 PDT 2007


Bugs item #1771668, was opened at 2007-08-10 09:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1771668&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Other
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: ZamFear (zamfear)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxDateTime::Subtract is off by one hour

Initial Comment:
the wxDateTime function
wxTimeSpan Subtract(const wxDateTime& dt) const
appears to be off by one hour.

I use wxDateTime::Subtract to subtract one wxDateTime from another.  Both are constructed from tm stucts.  Using either wxTimeSpan::Format or wxTimeSpan::GetHour, the reported difference between the two times is one hour too low (eg 11:00am - 9:00am would only show a difference of 1 hour).

I currently get around this by adding wxTimeSpan::Hour() to my result, which corrects it, except when w1 > w2 and there is less than one hour between w1 and w2 (the result is positive when it should be negative).

I am using wxMSW-2.8.4, ANSI release build, MinGW GCC version 3.4.2.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1771668&group_id=9863




More information about the wx-dev mailing list