! \overload A convenience method which turns a QDateTime object into a double value that corresponds to seconds since Epoch (1. Jan 1970, 00:00 UTC). This is the format used as axis coordinates by QCPAxisTickerDateTime. The accuracy achieved by this method is one millisecond, irrespective of the used Qt version (it works around the lack of a QDateTime::toMSecsSinceEpoch in Qt 4.6)
| 6802 | \see keyToDateTime |
| 6803 | */ |
| 6804 | double QCPAxisTickerDateTime::dateTimeToKey(const QDateTime &dateTime) |
| 6805 | { |
| 6806 | # if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) |
| 6807 | return dateTime.toTime_t()+dateTime.time().msec()/1000.0; |
| 6808 | # else |
| 6809 | return dateTime.toMSecsSinceEpoch()/1000.0; |
| 6810 | # endif |
| 6811 | } |
| 6812 | |
| 6813 | /*! \overload |
| 6814 |