MCPcopy Create free account
hub / github.com/cutechess/cutechess / keyToDateTime

Method keyToDateTime

projects/gui/3rdparty/qcustomplot/qcustomplot.cpp:6784–6791  ·  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

6782 \see dateTimeToKey
6783*/
6784QDateTime QCPAxisTickerDateTime::keyToDateTime(double key)
6785{
6786# if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
6787 return QDateTime::fromTime_t(key).addMSecs((key-(qint64)key)*1000);
6788# else
6789 return QDateTime::fromMSecsSinceEpoch(qint64(key*1000.0));
6790# endif
6791}
6792
6793/*! \overload
6794

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected