2
* Copyright (C) 2015 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef QTMIR_TIMESTAMP_H
18
#define QTMIR_TIMESTAMP_H
20
#include <QtCore/qglobal.h>
25
// Converts a mir timestamp (in nanoseconds) to and from a timestamp in milliseconds.
26
// Qt system events only work with ulong timestamps. On 32bit archs a ulong is 4 bytes long, so the 64 bit nanoseconds
27
// will be truncated and skewed. In order to fix this, we truncate the result by using time since "first call"
29
T compressTimestamp(std::chrono::nanoseconds timestamp);
31
// "Re-inflate" a truncated timestamp.
33
std::chrono::nanoseconds uncompressTimestamp(T timestamp);
37
#include "timestamp_impl.h"
39
#endif // QTMIR_TIMESTAMP_H