Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::DateTime Class Reference

The DateTime class is a collection of static functions pertaining to date and time.

#include <qx/core/qx-datetime.h>

Static Public Member Functions

static QDateTime fromMSFileTime (quint64 fileTime)
 

Member Function Documentation

◆ fromMSFileTime()

QDateTime Qx::DateTime::fromMSFileTime ( quint64 fileTime)
static

Returns a datetime by converting the given Microsoft FILETIME, fileTime.

The first and last datetimes officially representable by a FILETIME structure are January 1 1970 0:00:00 and Dec 31 30827 23:59:59 respectively, as it was designed to be compatible with Microsoft SYSTEMTIME.

The timezone of the resultant QDateTime is Qt::LocalTime.

Note
The official FILETIME object from the Windows C API is a structure of two DWORD (32-bit) values that represent the low and high portion of the true signed 64-bit value of the FILETIME; however, FILETIME encoded information can be acquired from various sources such as raw data from files on disk. For this reason, this function's signature takes an unsigned 64-bit integer instead of the aforementioned struct. If working with actual FILETIME structures from the Windows C API the values of said structures must first be converted to single value integers in order to be used with this function. This implementation approach allows this module to avoid linking to the Windows library.
Warning
FILETIME encoding has a resolution of 100 nanoseconds, while QDateTime is only 1 millisecond, which means that there is some loss in accuracy during conversion (fileTime is rounded to the nearest millisecond). This is fine in most cases, but if your application requires sub-millisecond accuracy in the context of disk records then do not rely on this function.
See also
QDateTime::fromMSecsSinceEpoch(), fromMSFileTime( SYSTEMTIME, Why can’t you treat a FILETIME as an __int64?

The documentation for this class was generated from the following files: