[Qt-interest] How calculate time span (days, hours, minutes) QDateTime difference?
Jason H
scorp1us at yahoo.com
Fri Jun 11 20:09:16 CEST 2010
Having a TimeSpan class would be wonderful. I've used the MS one with great success and appreciation.
Qt's date/time handling has been horrendous, but getting better. Please also note timezone issues. As we become a more interconnected net society, we need to be able to translate dates/times across timezone/date boundaries. This effects Q[Date][Time] edits as well. The "universal" fix is to store everything in UTC, then convert to local time zones.
As for how that applies, you should get a 1 hour difference between 12:00am(-5UTC) and 12:00am(-4 UTC). Also, note that not all timezones are on hour boundaries. Also, UTC!=GMT, GMT observes daylight savings....
----- Original Message ----
From: Sean Harmer <sean.harmer at maps-technology.com>
To: qt-interest at trolltech.com
Sent: Fri, June 11, 2010 1:49:57 PM
Subject: Re: [Qt-interest] How calculate time span (days, hours, minutes) QDateTime difference?
Hi,
On Friday 11 June 2010 16:58:08 Ed Sutton wrote:
> >http://doc.trolltech.com/4.6/qdatetime.html#secsTo
> >
> >gives you seconds.
> >
> >The rest is trivial.
>
> Thank you Dan and Jason.
>
> QDateTime::secsTo() does the trick with some additional work.
>
> I was hoping I had missed the Qt equivalent of the .NET TimeSpan structure.
>
> http://msdn.microsoft.com/en-us/library/system.timespan.aspx
Yes I have been thinking about adding something like this for a while now.
Maybe I will try to put a merge request together on gitorious for such a
class.
Does anybody have any other features that they would like for such a class?
Cheers,
Sean
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list