MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / dateTimeToKey

Method dateTimeToKey

qcustomplot.cpp:6122–6129  ·  view source on GitHub ↗

! \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)

Source from the content-addressed store, hash-verified

6120 \see keyToDateTime
6121*/
6122double QCPAxisTickerDateTime::dateTimeToKey(const QDateTime dateTime)
6123{
6124# if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
6125 return dateTime.toTime_t()+dateTime.time().msec()/1000.0;
6126# else
6127 return dateTime.toMSecsSinceEpoch()/1000.0;
6128# endif
6129}
6130
6131/*! \overload
6132

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected