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// Qt-Security score:significant reason:default
4
5#ifndef Q20CHRONO_H
6#define Q20CHRONO_H
7
8#include <QtCore/qtconfigmacros.h>
9
10#include <chrono>
11
12//
13// W A R N I N G
14// -------------
15//
16// This file is not part of the Qt API. Types and functions defined in this
17// file can reliably be replaced by their std counterparts, once available.
18// You may use these definitions in your own code, but be aware that we
19// will remove them once Qt depends on the C++ version that supports
20// them in namespace std. There will be NO deprecation warning, the
21// definitions will JUST go away.
22//
23// If you can't agree to these terms, don't use these definitions!
24//
25// We mean it.
26//
27
29
30namespace q20 {
31namespace chrono {
32
33#if defined(__GLIBCXX__)
34// https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/bits/chrono.h
35using IntRep = int64_t;
36#else
37// https://github.com/llvm/llvm-project/blob/main/libcxx/include/__chrono/duration.h
38// https://github.com/microsoft/STL/blob/main/stl/inc/__msvc_chrono.hpp
39using IntRep = int;
40#endif
41
42// INTEGRITY incident-85878 (timezone and clock_cast are not supported)
43#if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
44using std::chrono::days;
45using std::chrono::weeks;
46using std::chrono::years;
47using std::chrono::months;
48
49static_assert(std::is_same_v<days::rep, IntRep>);
50static_assert(std::is_same_v<weeks::rep, IntRep>);
51static_assert(std::is_same_v<years::rep, IntRep>);
52static_assert(std::is_same_v<months::rep, IntRep>);
53#else
54using days = std::chrono::duration<IntRep, std::ratio<86400>>;
58#endif // __cpp_lib_chrono >= 201907L
59} // namespace chrono
60} // namespace q20
61
62QT_END_NAMESPACE
63
64#endif /* Q20CHRONO_H */
const QTextStreamPrivate::Params m_streamParams
Definition qdebug.cpp:1401
QDebugStateSaverPrivate(QDebug::Stream *stream)
Definition qdebug.cpp:1369
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
Definition qmetaobject.h:20
\inmodule QtCore
\inmodule QtCore
Definition qproperty.h:731
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
QDebug qt_QMetaEnum_debugOperator(QDebug &dbg, qint64 value, const QMetaObject *meta, const char *name)
Definition qdebug.cpp:1486
static void putEscapedString(QTextStreamPrivate *d, const Char *begin, size_t length, bool isUnicode=true)
Definition qdebug.cpp:216
static bool isPrintable(char16_t uc)
Definition qdebug.cpp:211
static QByteArray timeUnit(qint64 num, qint64 den)
Definition qdebug.cpp:367
static bool isPrintable(uchar c)
Definition qdebug.cpp:212
static bool isPrintable(char32_t ucs4)
Definition qdebug.cpp:210
void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, uint value)
Definition qdebug.cpp:1435