summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensors/winrt/winrtcommon.cpp
blob: e655a6725e68c9f8b43577cec109c7d65bca26f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "winrtcommon.h"

#include <windows.foundation.h>

QT_USE_NAMESPACE

Q_LOGGING_CATEGORY(lcWinRtSensors, "qt.sensors.winrt")

quint64 dateTimeToMsSinceEpoch(const ABI::Windows::Foundation::DateTime &dateTime)
{
    // Convert 100-ns units since 01-01-1601 to ms since 01-01-1970
    return dateTime.UniversalTime / 10000 - 11644473600000LL;
}