[Qt-interest] How calculate time span (days, hours, minutes) QDateTime difference?

Jason H scorp1us at yahoo.com
Sat Jun 12 05:58:00 CEST 2010


----- Original Message ----

From: Dan White <ygor at comcast.net>
To: Qt-interest Interest <qt-interest at trolltech.com>
Sent: Fri, June 11, 2010 4:52:32 PM
Subject: Re: [Qt-interest] How calculate time span (days, hours, minutes) QDateTime difference?

> Why make another class ?  Seems like a waste.

Because a time is like a pointer, a time span/difference is like a offset. You can't add two pointers, but you can add a pointer and an offset.

Also note that the timespan should also correctly support milliseconds. You can union two time spans, or intersect them, but you can't add them. This is because a timespan should have a starting time. If you just want the span, then you can just get the time difference in seconds.milliseconds.

so 1.1111 - 2.1112 = -1.0001


      




More information about the Qt-interest-old mailing list