MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / keyToDateTime

Method keyToDateTime

qcustomplot/qcustomplot.cpp:6102–6109  ·  view source on GitHub ↗

! A convenience method which turns \a key (in seconds since Epoch 1. Jan 1970, 00:00 UTC) into a QDateTime object. This can be used to turn axis coordinates to actual QDateTimes. The accuracy achieved by this method is one millisecond, irrespective of the used Qt version (it works around the lack of a QDateTime::fromMSecsSinceEpoch in Qt 4.6) \see dateTimeToKey */

Source from the content-addressed store, hash-verified

6100 \see dateTimeToKey
6101*/
6102QDateTime QCPAxisTickerDateTime::keyToDateTime(double key)
6103{
6104# if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
6105 return QDateTime::fromTime_t(key).addMSecs((key-(qint64)key)*1000);
6106# else
6107 return QDateTime::fromMSecsSinceEpoch(key*1000.0);
6108# endif
6109}
6110
6111/*! \overload
6112

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected