Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
q20chrono.h
Go to the documentation of this file.
1// Copyright (C) 2023 Ahmad Samir <a.samirh78@gmail.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef Q20CHRONO_H
5#define Q20CHRONO_H
6
7#include <QtCore/qtconfigmacros.h>
8
9#include <chrono>
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. Types and functions defined in this
16// file can reliably be replaced by their std counterparts, once available.
17// You may use these definitions in your own code, but be aware that we
18// will remove them once Qt depends on the C++ version that supports
19// them in namespace std. There will be NO deprecation warning, the
20// definitions will JUST go away.
21//
22// If you can't agree to these terms, don't use these definitions!
23//
24// We mean it.
25//
26
28
29namespace q20 {
30namespace chrono {
31
32#if defined(__GLIBCXX__)
33// https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/bits/chrono.h
34using IntRep = int64_t;
35#else
36// https://github.com/llvm/llvm-project/blob/main/libcxx/include/__chrono/duration.h
37// https://github.com/microsoft/STL/blob/main/stl/inc/__msvc_chrono.hpp
38using IntRep = int;
39#endif
40
41// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
42#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
43using std::chrono::days;
44using std::chrono::weeks;
45using std::chrono::years;
46using std::chrono::months;
47
48static_assert(std::is_same_v<days::rep, IntRep>);
49static_assert(std::is_same_v<weeks::rep, IntRep>);
50static_assert(std::is_same_v<years::rep, IntRep>);
51static_assert(std::is_same_v<months::rep, IntRep>);
52#else
53using days = std::chrono::duration<IntRep, std::ratio<86400>>;
57#endif // __cpp_lib_chrono >= 201907L
58} // namespace chrono
59} // namespace q20
60
61QT_END_NAMESPACE
62
63#endif /* Q20CHRONO_H */
const QTextStreamPrivate::Params m_streamParams
Definition qdebug.cpp:1385
QDebugStateSaverPrivate(QDebug::Stream *stream)
Definition qdebug.cpp:1353
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qmetaobject.h:19
\inmodule QtCore
\inmodule QtCore
Definition qproperty.h:730
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
QDebug qt_QMetaEnum_debugOperator(QDebug &dbg, qint64 value, const QMetaObject *meta, const char *name)
Definition qdebug.cpp:1470
static void putEscapedString(QTextStreamPrivate *d, const Char *begin, size_t length, bool isUnicode=true)
Definition qdebug.cpp:200
static bool isPrintable(char16_t uc)
Definition qdebug.cpp:195
static QByteArray timeUnit(qint64 num, qint64 den)
Definition qdebug.cpp:351
static bool isPrintable(uchar c)
Definition qdebug.cpp:196
static bool isPrintable(char32_t ucs4)
Definition qdebug.cpp:194
void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, uint value)
Definition qdebug.cpp:1419