File indexing completed on 2026-09-29 09:22:59
0001
0002
0003
0004
0005 #ifndef Q20CHRONO_H
0006 #define Q20CHRONO_H
0007
0008 #include <QtCore/qtconfigmacros.h>
0009
0010 #include <chrono>
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 QT_BEGIN_NAMESPACE
0029
0030 namespace q20 {
0031 namespace chrono {
0032
0033 #if defined(__GLIBCXX__)
0034
0035 using IntRep = int64_t;
0036 #else
0037
0038
0039 using IntRep = int;
0040 #endif
0041
0042
0043 #if __cpp_lib_chrono >= 201907L && !defined(Q_OS_INTEGRITY)
0044 using std::chrono::days;
0045 using std::chrono::weeks;
0046 using std::chrono::years;
0047 using std::chrono::months;
0048
0049 static_assert(std::is_same_v<days::rep, IntRep>);
0050 static_assert(std::is_same_v<weeks::rep, IntRep>);
0051 static_assert(std::is_same_v<years::rep, IntRep>);
0052 static_assert(std::is_same_v<months::rep, IntRep>);
0053 #else
0054 using days = std::chrono::duration<IntRep, std::ratio<86400>>;
0055 using weeks = std::chrono::duration<IntRep, std::ratio_multiply<std::ratio<7>, days::period>>;
0056 using years = std::chrono::duration<IntRep, std::ratio_multiply<std::ratio<146097, 400>, days::period>>;
0057 using months = std::chrono::duration<IntRep, std::ratio_divide<years::period, std::ratio<12>>>;
0058 #endif
0059 }
0060 }
0061
0062 QT_END_NAMESPACE
0063
0064 #endif