Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
None
-
None
Description
Identifying a date and time uniquely is often useful when scheduling events or storing it binary.
Currently, the most efficient way I've found is:
now = QDateTime::currentDateTime();
when = (qint64) now.date().toJulianDay() * (qint64) (24 * 60 * 60 * 1000);
when += QTime().msecsTo(now.time());
This, however, could be optimized by adding a simple member function in QDateTime:
{{qint64 toInt64()
{ return (qint64) (d->date.jd) * Q_INT64_C((24 * 60 * 60 * 1000)) + (qint64)(d->time.ds()); }}}