Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9017

Add a QDateTime::toInt64() member

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • None
    • Core: Date/Time
    • 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()); }

      }}

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tmacieir Thiago Macieira (closed Nokia identity) (Inactive)
            sirreal Johan Lindh
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes