Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, April 2007
QDateTime, mSecsTo


Message 1 in thread

QDateTime have function:
int secsTo ( const QDateTime & other ) const
to get difference in seconds between two dates

I think it may be worthy to add (as mSecsTo is already part of QTime)
qint64 mSecsTo ( const QDateTime & other ) const
method to QDateTime class, which will return the difference in milliseconds.

If I need difference between two qdatetimes with millisecond
precision, now I have to extract QDate & QTime via date() and time()
and compute the difference "manually" via code like this:

 qint64 dt=this_time.date().daysTo(other.date());
 qint64 tt=this_time.time().mSecsTo(other.time());
 return dt*(1000*3600*24)+tt;

Martin Petricek

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx