13#include "private/qcalendarmath_p.h" 
   14#include "private/qdatetime_p.h" 
   15#if QT_CONFIG(datetimeparser) 
   16#include "private/qdatetimeparser_p.h" 
   19#include "private/qcore_mac_p.h" 
   21#include "private/qgregoriancalendar_p.h" 
   22#include "private/qlocale_tools_p.h" 
   23#include "private/qlocaltime_p.h" 
   24#include "private/qnumeric_p.h" 
   25#include "private/qstringconverter_p.h" 
   26#include "private/qstringiterator_p.h" 
   27#if QT_CONFIG(timezone) 
   28#include "private/qtimezoneprivate_p.h" 
   36#include <private/qtools_p.h> 
   51static_assert(std::is_trivially_copyable_v<QCalendar::YearMonthDay>);
 
   77#if QT_CONFIG(textdate) 
   78static const char qt_shortMonthNames[][4] = {
 
   79    "Jan", 
"Feb", 
"Mar", 
"Apr", 
"May", 
"Jun",
 
   80    "Jul", 
"Aug", 
"Sep", 
"Oct", 
"Nov", 
"Dec" 
   85    for (
unsigned int i = 0; 
i < 
sizeof(qt_shortMonthNames) / 
sizeof(qt_shortMonthNames[0]); ++
i) {
 
   93#if QT_CONFIG(datestring)  
  130struct ParsedRfcDateTime {
 
  138    const char16_t shortDayNames[] = u
"MonTueWedThuFriSatSun";
 
  139    for (
int i = 0; 
i < 7; 
i++) {
 
  156    for (
int i = 0; 
i < 6 && 
it != tokens.
end(); ++
i, ++
it)
 
  159    if (words.
size() < 3 || 
it != tokens.
end())
 
  161    const QChar colon(u
':');
 
  166        return (
name.size() == 3 && 
name[0].isUpper()
 
  167                && 
name[1].isLower() && 
name[2].isLower());
 
  179            dayName = maybeDayName.
chopped(1);
 
  182            dayName = maybeDayName;
 
  186        if (words.
size() < 3 || words.
size() > 5)
 
  190        int dayIndex, monthIndex;
 
  200            yearIndex = words.
size() > 3 && words.
at(2).contains(colon) ? 3 : 2;
 
  205            if (!isShortName(dayName))
 
  207            dayOfWeek = shortDayFromName(dayName);
 
  212        const int day = words.
at(dayIndex).toInt(&
ok);
 
  215        const int year = words.
at(yearIndex).toInt(&
ok);
 
  219        if (!isShortName(monthName))
 
  221        int month = fromShortMonthName(monthName);
 
  234    if (words.
size() && words.
at(0).contains(colon)) {
 
  237        if (when.
size() < 5 || when[2] != colon
 
  238            || (when.
size() == 8 ? when[5] != colon : when.
size() > 5)) {
 
  258        if (words.
size() || !(zone.
size() == 3 || zone.
size() == 5))
 
  263        else if (zone[0] != u
'+')
 
  271        offset = (hour * 60 + minute) * 60;
 
  294#if QT_CONFIG(datestring) 
  296static int fromOffsetString(
QStringView offsetString, 
bool *valid) 
noexcept 
  300    const int size = offsetString.size();
 
  301    if (size < 2 || size > 6)
 
  308    const QChar signChar = offsetString[0];
 
  309    if (signChar == u
'+')
 
  311    else if (signChar == u
'-')
 
  327    const int hour = hhRef.
toInt(&
ok);
 
  328    if (!
ok || hour > 23) 
 
  333    if (!
ok || minute < 0 || minute > 59)
 
  337    return sign * ((hour * 60) + minute) * 60;
 
  687            return firstDay.
daysTo(*
this) + 1;
 
  700            return jd - *
first + 1;
 
  793        *yearNumber = thursday.
year();
 
  799#if QT_DEPRECATED_SINCE(6, 9) 
  806            qWarning(
"%s: Pass a QTimeZone instead of Qt::TimeZone.", warner);
 
  810                qWarning(
"%s: Ignoring offset (%d seconds) passed with Qt::LocalTime",
 
  816                qWarning(
"%s: Ignoring offset (%d seconds) passed with Qt::UTC",
 
  835    using Bounds = std::numeric_limits<qint64>;
 
  846        return jd > minDay && jd <= maxDay;
 
  848        return jd >= minDay && jd < maxDay;
 
  850    Q_UNREACHABLE_RETURN(
false);
 
  861        when = moment(
QTime(12, 0));
 
  864            when = moment(
QTime(23, 59, 59, 999));
 
  872    while (high > low + 1) {
 
  873        const int mid = (high + low) / 2;
 
  888        while (high > low + 1) {
 
  889            const int mid = (high + low) / 2;
 
  890            const int min = mid / 60;
 
  891            const QDateTime probe = moment(
QTime(min / 60, min % 60, mid % 60));
 
  940#if QT_CONFIG(timezone) 
  943        QTimeZone::OffsetData tran
 
  948        if (
at.isValid() && 
at.date() == *
this)
 
  965#if QT_DEPRECATED_SINCE(6, 9) 
  996    QTimeZone zone = asTimeZone(spec, offsetSeconds, 
"QDate::startOfDay");
 
 1010        when = moment(
QTime(12, 0));
 
 1013            when = moment(
QTime(0, 0));
 
 1021    while (high > low + 1) {
 
 1022        const int mid = (high + low) / 2;
 
 1023        const QDateTime probe = moment(
QTime(mid / 60, mid % 60, 59, 999));
 
 1037        while (high > low + 1) {
 
 1038            const int mid = (high + low) / 2;
 
 1039            const int min = mid / 60;
 
 1040            const QDateTime probe = moment(
QTime(min / 60, min % 60, mid % 60, 999));
 
 1090#if QT_CONFIG(timezone) 
 1093        QTimeZone::OffsetData tran
 
 1097        const QDateTime &
at = tran.atUtc.toTimeZone(zone);
 
 1098        if (
at.isValid() && 
at.date() == *
this)
 
 1115#if QT_DEPRECATED_SINCE(6, 9) 
 1146    QTimeZone zone = asTimeZone(spec, offsetSeconds, 
"QDate::endOfDay");
 
 1152#if QT_CONFIG(datestring)  
 1159        if (parts.isValid()) {
 
 1173    if (parts.isValid() && parts.year >= 0 && parts.year <= 9999)
 
 1216        return toStringTextDate(*
this);
 
 1220        return toStringIsoDate(*
this);
 
 1304    jd = maybe.value_or(nullJd());
 
 1418    if (!parts.isValid())
 
 1422    parts.month += nmonths;
 
 1423    while (parts.month <= 0) {
 
 1428    while (parts.month > 
count) {
 
 1429        parts.month -= 
count;
 
 1450    if (!parts.isValid())
 
 1454    parts.month += nmonths;
 
 1455    while (parts.month <= 0) {
 
 1459    while (parts.month > 12) {
 
 1488    if (!parts.isValid())
 
 1491    int old_y = parts.year;
 
 1492    parts.year += nyears;
 
 1495    if (!cal.
hasYearZero() && ((old_y > 0) != (parts.year > 0) || !parts.year))
 
 1496        parts.year += nyears > 0 ? +1 : -1;
 
 1511    if (!parts.isValid())
 
 1514    int old_y = parts.year;
 
 1515    parts.year += nyears;
 
 1518    if ((old_y > 0) != (parts.year > 0) || !parts.year)
 
 1519        parts.year += nyears > 0 ? +1 : -1;
 
 1595#if QT_CONFIG(datestring)  
 1616    if (
string.isEmpty())
 
 1621        return rfcDateImpl(
string).date;
 
 1628        for (
int i = 0; 
i < 4 && 
it != tokens.
end(); ++
i, ++
it)
 
 1631        if (parts.
size() != 4 || 
it != tokens.
end())
 
 1636        int day = 
ok ? parts.
at(2).toInt(&
ok) : 0;
 
 1640        const int month = fromShortMonthName(parts.
at(1));
 
 1648        if (
string.
size() >= 10 && 
string[4].isPunct() && 
string[7].isPunct()
 
 1649                && (
string.
size() == 10 || !
string[10].
isDigit())) {
 
 1650            const ParsedInt 
year = readInt(
string.
first(4));
 
 1651            const ParsedInt 
month = readInt(
string.sliced(5, 2));
 
 1652            const ParsedInt 
day = readInt(
string.sliced(8, 2));
 
 1746#if QT_CONFIG(datetimeparser) 
 1749    if (dt.parseFormat(
format))
 
 1750        dt.fromString(
string, &
date, 
nullptr);
 
 1966#if QT_CONFIG(datestring)  
 1991QString QTime::toString(Qt::DateFormat format) const
 
 1998        return QString::asprintf(
"%02d:%02d:%02d.%03d", hour(), minute(), second(), msec());
 
 2182    return theirSeconds - ourSeconds;
 
 2201        t.mds = QRoundingDown::qMod<MSECS_PER_DAY>(ds() + ms);
 
 2223    return t.ds() - ds();
 
 2299#if QT_CONFIG(datestring)  
 2305        *isMidnight24 = 
false;
 
 2311    const int dot = 
string.indexOf(u
'.'), comma = 
string.indexOf(u
',');
 
 2316        string = 
string.first(
dot);
 
 2317    } 
else if (comma != -1) {
 
 2318        tail = 
string.
sliced(comma + 1);
 
 2319        string = 
string.
first(comma);
 
 2324    const ParsedInt frac = readInt(tail);
 
 2326    if (tail.
isEmpty() ? 
dot != -1 || comma != -1 : !frac.
ok())
 
 2329    double fraction = frac.ok() ? frac.result * std::pow(0.1, tail.
size()) : 0.0;
 
 2331    const int size = 
string.size();
 
 2332    if (size < 2 || size > 8)
 
 2335    ParsedInt hour = readInt(
string.
first(2));
 
 2340    if (
string.
size() > 2) {
 
 2341        if (
string[2] == u
':' && 
string.
size() > 4)
 
 2342            minute = readInt(
string.sliced(3, 2));
 
 2347    } 
else if (frac.ok()) {
 
 2348        Q_ASSERT(!(fraction < 0.0) && fraction < 1.0);
 
 2351        fraction -= minute.result;
 
 2355    if (
string.
size() > 5) {
 
 2356        if (
string[5] == u
':' && 
string.
size() == 8)
 
 2357            second = readInt(
string.sliced(6, 2));
 
 2360    } 
else if (frac.ok()) {
 
 2363        Q_ASSERT(!(fraction < 0.0) && fraction < 1.0);
 
 2366        fraction -= second.result;
 
 2369    Q_ASSERT(!(fraction < 0.0) && fraction < 1.0);
 
 2376        if (isMidnight24 || hour.result < 23 || minute.result < 59 || second.result < 59) {
 
 2394    if (hour.result == 24 && minute.result == 0 && second.result == 0 && msec == 0) {
 
 2397            *isMidnight24 = 
true;
 
 2401    return QTime(hour.result, minute.result, second.result, msec);
 
 2419    if (
string.isEmpty())
 
 2424        return rfcDateImpl(
string).time;
 
 2429        return fromIsoTimeString(
string, 
format, 
nullptr);
 
 2524#if QT_CONFIG(datetimeparser) 
 2527    if (dt.parseFormat(
format))
 
 2528        dt.fromString(
string, 
nullptr, &
time);
 
 2586    return qMulOverflow(days, std::integral_constant<qint64, MSECS_PER_DAY>(), sumMillis)
 
 2595    if (days < 0 && dayms > 0) {
 
 2600        using Bound = std::numeric_limits<qint64>;
 
 2601        return days < 0 ? Bound::min() : Bound::max();
 
 2626    return (bounds.minClip || millis >= bounds.min - slack)
 
 2627        && (bounds.maxClip || millis <= bounds.max + slack);
 
 2648#if defined(Q_OS_WIN) || defined(Q_OS_WASM) 
 2649    static constexpr int forLeapEarly[] = { 1984, 1996, 1980, 1992, 1976, 1988, 1972 };
 
 2650    static constexpr int regularEarly[] = { 1978, 1973, 1974, 1975, 1970, 1971, 1977 };
 
 2652    static constexpr int forLeapEarly[] = { 1928, 1912, 1924, 1908, 1920, 1904, 1916 };
 
 2653    static constexpr int regularEarly[] = { 1905, 1906, 1907, 1902, 1903, 1909, 1910 };
 
 2655    static constexpr int forLeapLate[] = { 2012, 2024, 2036, 2020, 2032, 2016, 2028 };
 
 2656    static constexpr int regularLate[] = { 2034, 2035, 2030, 2031, 2037, 2027, 2033 };
 
 2660                     ? (year < 1970 ? forLeapEarly : forLeapLate)
 
 2661                     : (year < 1970 ? regularEarly : regularLate))[dow == 7 ? 0 : dow];
 
 2680#if QT_CONFIG(timezone)  
 2681    if (
const auto sys = QTimeZone::systemTimeZone(); sys.isValid()) {
 
 2682        result.offset = sys.d->offsetFromUtc(utcMSecs);
 
 2696    qint64 diffMillis, fakeUtc;
 
 2698                                                            ymd.month, ymd.day);
 
 2700                   || 
qMulOverflow(jd - *fakeJd, std::integral_constant<qint64, MSECS_PER_DAY>(),
 
 2726                                                            ymd.month, ymd.day);
 
 2737            return abbreviation;
 
 2741#if QT_CONFIG(timezone) 
 2743    const auto sys = QTimeZone::systemTimeZone();
 
 2744    if (sys.isValid()) {
 
 2773#if QT_CONFIG(timezone) 
 2775    const auto sys = QTimeZone::systemTimeZone();
 
 2777        return zoneStateAtMillis(sys, millis, 
dst);
 
 2788                using Bound = std::numeric_limits<qint64>;
 
 2789                adjusted = millis < fake.shifted ? Bound::min() : Bound::max();
 
 2801#if QT_CONFIG(timezone) 
 2814    Q_ASSERT(zone.d->offsetFromUtc(
data.atMSecsSinceEpoch) == 
data.offsetFromUtc);
 
 2820    if (millis != 
state.when)
 
 2831#if QT_CONFIG(timezone) 
 2833        return QDateTimePrivate::zoneStateAtMillis(zone, millis, 
dst);
 
 2845    if constexpr (!QDateTimeData::CanBeSmall)
 
 2850    return sd.msecs == msecs;
 
 2853static constexpr inline 
 2867static constexpr inline QDateTimePrivate::StatusFlags
 
 2880static constexpr inline 
 2940        return a->m_offsetFromUtc == 
b->m_offsetFromUtc;
 
 2942    Q_UNREACHABLE_RETURN(
false);
 
 2951    int offsetFromUtc = 0;
 
 2966        offsetFromUtc = 
state.offset;
 
 2975        d.data.status = status.toInt();
 
 2977        d->m_status = status;
 
 2978        d->m_offsetFromUtc = offsetFromUtc;
 
 2991        d.data.status = status.toInt();
 
 2993        d->m_status = status;
 
 3019    bool reuse = 
d.isShort();
 
 3040        d.data.status = status.toInt();
 
 3045#if QT_CONFIG(timezone) 
 3047            d->m_timeZone = zone;
 
 3063    QDateTimePrivate::StatusFlags newStatus = { };
 
 3081    if (days < 0 && ds > 0) {
 
 3089        newStatus = QDateTimePrivate::StatusFlags{};
 
 3098            d.data.status |= newStatus.toInt();
 
 3108        d->m_status |= newStatus;
 
 3116    const auto dayMilli = QRoundingDown::qDivMod<MSECS_PER_DAY>(msecs);
 
 3129inline QDateTime::Data::Data() noexcept
 
 3138inline QDateTime::Data::Data(
const QTimeZone &zone)
 
 3153            d->m_timeZone = zone;
 
 3158inline QDateTime::Data::Data(
const Data &
other) noexcept
 
 3175inline QDateTime::Data::Data(
Data &&
other) noexcept
 
 3181    other.data = dummy.data;
 
 3184inline QDateTime::Data &QDateTime::Data::operator=(
const Data &
other) 
noexcept 
 3191    if (!
other.isShort()) {
 
 3209inline QDateTime::Data::~Data()
 
 3211    if (!isShort() && !
d->ref.deref())
 
 3215inline bool QDateTime::Data::isShort()
 const 
 3224    if constexpr (CanBeSmall)
 
 3229inline void QDateTime::Data::detach()
 
 3232    bool wasShort = isShort();
 
 3237        x->m_msecs = 
data.msecs;
 
 3239        if (
d->ref.loadRelaxed() == 1)
 
 3245    x->ref.storeRelaxed(1);
 
 3246    if (!wasShort && !
d->ref.deref())
 
 3251QTimeZone QDateTime::Data::timeZone()
 const 
 3259#if QT_CONFIG(timezone) 
 3260        if (
d->m_timeZone.isValid())
 
 3261            return d->m_timeZone;
 
 3291    QDateTime::Data 
result(zone);
 
 3475#if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) || QT_POINTER_SIZE == 8 
 3477    static_assert(
sizeof(
Data) == 
sizeof(
qint64));
 
 3479    static_assert(
sizeof(
ShortData) >= 
sizeof(
void*), 
"oops, Data::swap() is broken!");
 
 3482#if QT_DEPRECATED_SINCE(6, 9) 
 3665    return d.timeZone();
 
 3668#if QT_CONFIG(timezone) 
 3686    return d.timeZone().asBackendZone();
 
 3715        return d->m_offsetFromUtc;
 
 3762#if !QT_CONFIG(timezone) 
 3766        return d->m_timeZone.abbreviation(*
this);
 
 3796#if !QT_CONFIG(timezone) 
 3848#if QT_DEPRECATED_SINCE(6, 9) 
 3869    reviseTimeZone(d, asTimeZone(spec, 0, 
"QDateTime::setTimeSpec"));
 
 3888void QDateTime::setOffsetFromUtc(
int offsetSeconds)
 
 3955#if QT_CONFIG(timezone) 
 3957        if (d->m_timeZone.isValid())
 
 3962    Q_UNREACHABLE_RETURN(0);
 
 4010            state.offset = d->m_offsetFromUtc;
 
 4017#if QT_CONFIG(timezone) 
 4018    } 
else if (spec == 
Qt::TimeZone && (d.detach(), d->m_timeZone.isValid())) {
 
 4019        const auto data = d->m_timeZone.d->data(msecs);
 
 4026                                                  data.daylightTimeOffset
 
 4029                d->m_msecs = 
state.when;
 
 4030                d->m_offsetFromUtc = 
state.offset;
 
 4042        d.data.status = status.toInt();
 
 4046        d->m_msecs = 
state.when;
 
 4047        d->m_offsetFromUtc = 
state.offset;
 
 4065    if (!
qMulOverflow(secs, std::integral_constant<qint64, MSECS_PER_SEC>(), &msecs)) {
 
 4067    } 
else if (d.isShort()) {
 
 4075#if QT_CONFIG(datestring)  
 4107QString QDateTime::toString(Qt::DateFormat format) const
 
 4121        buf = toStringTextDate(
p.first);
 
 4123        buf.insert(
buf.lastIndexOf(u
' '),
 
 4126        switch (timeSpec()) {
 
 4129#if QT_CONFIG(timezone) 
 4131            buf += u
' ' + 
d->m_timeZone.displayName(
 
 4149        buf = toStringIsoDate(
p.first);
 
 4247        d.data.msecs = 
state.when;
 
 4248        d.data.status = status.toInt();
 
 4251        d->m_status = status;
 
 4254            d->m_offsetFromUtc = 
state.offset;
 
 4347    if (
qMulOverflow(
s, std::integral_constant<qint64, MSECS_PER_SEC>(), &msecs))
 
 4373        } 
else if (dt.d.isShort()) {
 
 4384            if (dt.d.isShort()) {
 
 4390        } 
else if (d.isShort()) {
 
 4393                dt.d.data.msecs = 
qintptr(msecs);
 
 4396                dt.d->m_msecs = msecs;
 
 4400            dt.d->m_msecs = msecs;
 
 4561#if QT_DEPRECATED_SINCE(6, 9) 
 4583    return toTimeZone(asTimeZone(spec, 0, 
"toTimeSpec"));
 
 4663        ret.setTimeZone(timeZone);
 
 4681        return !
other.isValid();
 
 4682    if (!
other.isValid())
 
 4728        return other.isValid();
 
 4729    if (!
other.isValid())
 
 4910#if defined(Q_OS_WIN) 
 4911static inline uint msecsFromDecomposed(
int hour, 
int minute, 
int sec, 
int msec = 0)
 
 4920    return QDate(st.wYear, st.wMonth, st.wDay);
 
 4928    ct.
setHMS(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
 
 4940    (spec == 
Qt::LocalTime ? GetLocalTime : GetSystemTime)(&st);
 
 4941    QDate d(st.wYear, st.wMonth, st.wDay);
 
 4942    QTime t(msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds));
 
 4946    return spec == 
Qt::UTC ? utc : utc.toTimeZone(zone);
 
 4955    return msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds) +
 
 4969#elif defined(Q_OS_UNIX) 
 4990    gettimeofday(&tv, 
nullptr);
 
 4997    gettimeofday(&tv, 
nullptr);
 
 5001#error "What system is this?" 
 5004#if QT_DEPRECATED_SINCE(6, 9) 
 5031                               asTimeZone(spec, offsetSeconds, 
"QDateTime::fromMSecsSinceEpoch"));
 
 5060                              asTimeZone(spec, offsetSeconds, 
"QDateTime::fromSecsSinceEpoch"));
 
 5128#if QT_CONFIG(datestring)  
 5148    if (
string.isEmpty())
 
 5153        const ParsedRfcDateTime rfc = rfcDateImpl(
string);
 
 5155        if (!rfc.date.isValid() || !rfc.time.isValid())
 
 5164        const int size = 
string.size();
 
 5178        if (isoString.
size() < 2
 
 5186        isoString = isoString.
sliced(1); 
 
 5195            int signIndex = isoString.
size() - 1;
 
 5199                QChar character(isoString[signIndex]);
 
 5200                found = character == u
'+' || character == u
'-';
 
 5201            } 
while (!found && --signIndex >= 0);
 
 5208                isoString = isoString.
first(signIndex);
 
 5215        bool isMidnight24 = 
false;
 
 5228        for (
int i = 0; 
i < 6 && 
it != tokens.
end(); ++
i, ++
it)
 
 5233        if (parts.
size() < 5 || 
it != tokens.
end())
 
 5240        if (parts.
at(3).contains(u
':'))
 
 5242        else if (parts.
at(4).contains(u
':'))
 
 5248        int day = parts.
at(2).toInt(&
ok);
 
 5249        int year = 
ok ? parts.
at(yearPart).toInt(&
ok) : 0;
 
 5250        int month = fromShortMonthName(parts.
at(1));
 
 5251        if (!
ok || year == 0 || day == 0 || month < 1)
 
 5262        if (parts.
size() == 5)
 
 5266        if (
tz.startsWith(
"UTC"_L1)
 
 5383#if QT_CONFIG(datetimeparser) 
 5388    if (dt.parseFormat(
format) && (dt.fromString(
string, &datetime) || !datetime.
isValid()))
 
 5404#ifndef QT_NO_DATASTREAM 
 5435        date.jd = (jd != 0 ? jd : QDate::nullJd());
 
 5477        time.mds = (ds == 0) ? QTime::NullTime : int(ds);
 
 5501#if QT_CONFIG(timezone) 
 5564        in >> dt >> tm >> ts;
 
 5586        in >> dt >> tm >> ts;
 
 5594        in >> dt >> tm >> ts;
 
 5624#if !defined(QT_NO_DEBUG_STREAM) && QT_CONFIG(datestring) 
 5628    dbg.nospace() << 
"QDate(";
 
 5636        dbg.nospace() << 
"Invalid";
 
 5637    dbg.nospace() << 
')';
 
 5644    dbg.nospace() << 
"QTime(";
 
 5646        dbg.nospace() << 
time.toString(u
"HH:mm:ss.zzz");
 
 5648        dbg.nospace() << 
"Invalid";
 
 5649    dbg.nospace() << 
')';
 
 5656    dbg.nospace() << 
"QDateTime(";
 
 5659        dbg.noquote() << 
date.toString(u
"yyyy-MM-dd HH:mm:ss.zzz t")
 
 5665            dbg.space() << 
date.offsetFromUtc() << 
's';
 
 5668#if QT_CONFIG(timezone) 
 5669            dbg.space() << 
date.timeZone().id();
 
 5676        dbg.nospace() << 
"Invalid";
 
 5678    return dbg.nospace() << 
')';
 
The QCalendar class describes calendar systems.
QDate dateFromParts(int year, int month, int day) const
QString monthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised name for a month.
YearMonthDay partsFromDate(QDate date) const
Converts a QDate to a year, month, and day of the month.
bool hasYearZero() const
Returns true if this calendar has a year zero.
int monthsInYear(int year) const
Returns the number of months in the given year.
int dayOfWeek(QDate date) const
Returns the day of the week number for the given date.
bool isProleptic() const
Returns true if this calendar is proleptic.
int daysInMonth(int month, int year=Unspecified) const
Returns the number of days in the given month of the given year.
int daysInYear(int year) const
Returns the number of days in the given year.
constexpr bool isDigit() const noexcept
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false.
constexpr char toLatin1() const noexcept
Returns the Latin-1 character equivalent to the QChar, or 0.
\inmodule QtCore\reentrant
QDateTime::ShortData QDateTimeShortData
QDateTime::Data QDateTimeData
static ZoneState localStateAtMillis(qint64 millis, DaylightStatus dst)
static ZoneState expressUtcAsLocal(qint64 utcMSecs)
static QDateTime::Data create(QDate toDate, QTime toTime, const QTimeZone &timeZone)
static QString localNameAtMillis(qint64 millis, DaylightStatus dst)
\inmodule QtCore\reentrant
int offsetFromUtc() const
~QDateTime()
Destroys the datetime.
static QDateTime currentDateTime()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setMSecsSinceEpoch(qint64 msecs)
qint64 toMSecsSinceEpoch() const
static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone)
qint64 secsTo(const QDateTime &) const
Returns the number of seconds from this datetime to the other datetime.
QDateTime addMSecs(qint64 msecs) const
Returns a QDateTime object containing a datetime msecs milliseconds later than the datetime of this o...
QDateTime addMonths(int months) const
Returns a QDateTime object containing a datetime nmonths months later than the datetime of this objec...
bool isNull() const
Returns true if both the date and the time are null; otherwise returns false.
QDateTime & operator=(const QDateTime &other) noexcept
Copies the other datetime into this and returns this copy.
static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone)
QDateTime toTimeZone(const QTimeZone &toZone) const
qint64 msecsTo(const QDateTime &) const
Returns the number of milliseconds from this datetime to the other datetime.
QDateTime toUTC() const
Returns a copy of this datetime converted to UTC.
void setTime(QTime time)
Sets the time part of this datetime to time.
QTime time() const
Returns the time part of the datetime.
QDateTime() noexcept
Constructs a null datetime, nominally using local time.
QDateTime toLocalTime() const
Returns a copy of this datetime converted to local time.
QString timeZoneAbbreviation() const
QDateTime addSecs(qint64 secs) const
Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or...
static qint64 currentSecsSinceEpoch() noexcept
Qt::TimeSpec timeSpec() const
Returns the time specification of the datetime.
bool isDaylightTime() const
bool isValid() const
Returns true if this datetime represents a definite moment, otherwise false.
static QDateTime currentDateTimeUtc()
QDateTime toOffsetFromUtc(int offsetSeconds) const
qint64 daysTo(const QDateTime &) const
Returns the number of days from this datetime to the other datetime.
static qint64 currentMSecsSinceEpoch() noexcept
qint64 toSecsSinceEpoch() const
void setDate(QDate date)
Sets the date part of this datetime to date.
QTimeZone timeRepresentation() const
QDateTime addYears(int years) const
Returns a QDateTime object containing a datetime nyears years later than the datetime of this object ...
QDate date() const
Returns the date part of the datetime.
QDateTime addDays(qint64 days) const
Returns a QDateTime object containing a datetime ndays days later than the datetime of this object (o...
void setSecsSinceEpoch(qint64 secs)
void setTimeZone(const QTimeZone &toZone)
\inmodule QtCore \reentrant
int weekNumber(int *yearNum=nullptr) const
Returns the ISO 8601 week number (1 to 53).
QDateTime endOfDay() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qint64 daysTo(QDate d) const
Returns the number of days from this date to d (which is negative if d is earlier than this date).
constexpr bool isValid() const
Returns true if this date is valid; otherwise returns false.
constexpr qint64 toJulianDay() const
Converts the date to a Julian day.
int month() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static constexpr QDate fromJulianDay(qint64 jd_)
Converts the Julian day jd to a QDate.
int day() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDate addDays(qint64 days) const
Returns a QDate object containing a date ndays later than the date of this object (or earlier if nday...
QDate addYears(int years) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr bool isNull() const
Returns true if the date is null; otherwise returns false.
int year() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDate addMonths(int months) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void getDate(int *year, int *month, int *day) const
static QDate currentDate()
Returns the system clock's current date.
int daysInMonth() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDateTime startOfDay(const QTimeZone &zone) const
int daysInYear() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QDate()
Constructs a null date.
int dayOfYear() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDateTime startOfDay() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int dayOfWeek() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setDate(int year, int month, int day)
static bool isLeapYear(int year)
Returns true if the specified year is a leap year in the Gregorian calendar; otherwise returns false.
static std::optional< qint64 > julianFromParts(int year, int month, int day)
static int yearStartWeekDay(int year)
static int monthLength(int month, int year)
static bool leapTest(int year)
static QCalendar::YearMonthDay partsFromJulian(qint64 jd)
static bool validParts(int year, int month, int day)
static int weekDayOfJulian(qint64 jd)
constexpr const char * data() const noexcept
QString dayName(int, FormatType format=LongFormat) const
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
QString toString(qlonglong i) const
Returns a localized string representation of i.
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr void chop(qsizetype n) noexcept
Truncates this string view by length characters.
constexpr bool isEmpty() const noexcept
Returns whether this string view is empty - that is, whether {size() == 0}.
constexpr qsizetype size() const noexcept
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for...
constexpr QStringView first(qsizetype n) const noexcept
constexpr QStringView chopped(qsizetype n) const noexcept
Returns the substring of length size() - length starting at the beginning of this object.
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
int toInt(bool *ok=nullptr, int base=10) const
Returns the string view converted to an int using base base, which is 10 by default and must be betwe...
constexpr QStringView last(qsizetype n) const noexcept
constexpr QStringView sliced(qsizetype pos) const noexcept
constexpr QChar front() const
qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QChar * data()
Returns a pointer to the data stored in the QString.
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
static constexpr qint64 invalidSeconds()
static constexpr bool isUtcOrFixedOffset(Qt::TimeSpec spec) noexcept
constexpr int fixedSecondsAheadOfUtc() const noexcept
bool isValid() const
Returns true if this time zone is valid.
static QTimeZone fromSecondsAheadOfUtc(int offset)
constexpr bool isUtcOrFixedOffset() const noexcept
constexpr Qt::TimeSpec timeSpec() const noexcept
\inmodule QtCore \reentrant
int secsTo(QTime t) const
Returns the number of seconds from this time to t.
constexpr bool isNull() const
Returns true if the time is null (i.e., the QTime object was constructed using the default constructo...
static QTime currentTime()
Returns the current time as reported by the system clock.
QTime addMSecs(int ms) const
Returns a QTime object containing a time ms milliseconds later than the time of this object (or earli...
int hour() const
Returns the hour part (0 to 23) of the time.
int minute() const
Returns the minute part (0 to 59) of the time.
bool isValid() const
Returns true if the time is valid; otherwise returns false.
static constexpr QTime fromMSecsSinceStartOfDay(int msecs)
Returns a new QTime instance with the time set to the number of msecs since the start of the day,...
int msecsTo(QTime t) const
Returns the number of milliseconds from this time to t.
int msec() const
Returns the millisecond part (0 to 999) of the time.
bool setHMS(int h, int m, int s, int ms=0)
Sets the time to hour h, minute m, seconds s and milliseconds ms.
constexpr int msecsSinceStartOfDay() const
Returns the number of msecs since the start of the day, i.e.
int second() const
Returns the second part (0 to 59) of the time.
constexpr QTime()
Constructs a null time object.
QTime addSecs(int secs) const
Returns a QTime object containing a time s seconds later than the time of this object (or earlier if ...
constexpr size_type size() const noexcept
void remove(qsizetype i, qsizetype n=1)
T & emplace_back(Args &&...args)
const T & at(qsizetype idx) const
iterator erase(const_iterator begin, const_iterator end)
iterator begin() noexcept
QSet< QString >::iterator it
QString localTimeAbbbreviationAt(qint64 local, QDateTimePrivate::DaylightStatus dst)
SystemMillisRange computeSystemMillisRange()
QDateTimePrivate::ZoneState utcToLocal(qint64 utcMillis)
QDateTimePrivate::ZoneState mapLocalTime(qint64 local, QDateTimePrivate::DaylightStatus dst)
Combined button and popup list for selecting options.
constexpr bool isAsciiDigit(char32_t c) noexcept
constexpr qint64 JulianDayMax
constexpr qint64 SECS_PER_HOUR
constexpr qint64 MSECS_PER_MIN
constexpr qint64 SECS_PER_MIN
constexpr qint64 SECS_PER_DAY
constexpr qint64 JulianDayMin
constexpr qint64 MSECS_PER_DAY
constexpr qint64 JULIAN_DAY_FOR_EPOCH
constexpr qint64 MINS_PER_HOUR
constexpr qint64 MSECS_PER_SEC
constexpr qint64 MSECS_PER_HOUR
std::pair< T1, T2 > QPair
static QTime msecsToTime(qint64 msecs)
static auto millisToWithinRange(qint64 millis)
static QDateTime toLatest(QDate day, const QTimeZone &zone)
static constexpr QDateTimePrivate::StatusFlags mergeDaylightStatus(QDateTimePrivate::StatusFlags sf, QDateTimePrivate::DaylightStatus status)
static qint64 timeToMSecs(QDate date, QTime time)
static constexpr QDateTimePrivate::DaylightStatus extractDaylightStatus(QDateTimePrivate::StatusFlags status)
size_t qHash(const QDateTime &key, size_t seed)
static Qt::TimeSpec getSpec(const QDateTimeData &d)
QDateTimePrivate::QDateTimeShortData ShortData
static QDateTimePrivate::StatusFlags getStatus(const QDateTimeData &d)
static qint64 getMSecs(const QDateTimeData &d)
static bool inDateTimeRange(qint64 jd, DaySide side)
QDateTimePrivate::QDateTimeData QDateTimeData
static bool specCanBeSmall(Qt::TimeSpec spec)
static int systemTimeYearMatching(int year)
static constexpr QDateTimePrivate::StatusFlags mergeSpec(QDateTimePrivate::StatusFlags status, Qt::TimeSpec spec)
static QDate msecsToDate(qint64 msecs)
static QString toOffsetString(Qt::DateFormat format, int offset)
static void reviseTimeZone(QDateTimeData &d, QTimeZone zone)
static bool daysAndMillisOverflow(qint64 days, qint64 millisInDay, qint64 *sumMillis)
static QDate fixedDate(QCalendar::YearMonthDay parts, QCalendar cal)
static void massageAdjustedDateTime(QDateTimeData &d, QDate date, QTime time)
static void refreshSimpleDateTime(QDateTimeData &d)
static void setDateTime(QDateTimeData &d, QDate date, QTime time)
static bool msecsCanBeSmall(qint64 msecs)
static QPair< QDate, QTime > getDateTime(const QDateTimeData &d)
static constexpr Qt::TimeSpec extractSpec(QDateTimePrivate::StatusFlags status)
static void checkValidDateTime(QDateTimeData &d)
static bool usesSameOffset(const QDateTimeData &a, const QDateTimeData &b)
static QDateTimePrivate::ZoneState stateAtMillis(QTimeZone zone, qint64 millis, QDateTimePrivate::DaylightStatus dst)
static QDateTime toEarliest(QDate day, const QTimeZone &zone)
static bool millisInSystemRange(qint64 millis, qint64 slack=0)
static void refreshZonedDateTime(QDateTimeData &d, const QTimeZone &zone)
static qint64 msecsToJulianDay(qint64 msecs)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr T qAbs(const T &t)
std::enable_if_t< std::is_unsigned_v< T >, bool > qAddOverflow(T v1, T v2, T *r)
std::enable_if_t< std::is_unsigned_v< T >, bool > qSubOverflow(T v1, T v2, T *r)
std::enable_if_t< std::is_unsigned_v< T >||std::is_signed_v< T >, bool > qMulOverflow(T v1, T v2, T *r)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
static qreal dot(const QPointF &a, const QPointF &b)
static QT_BEGIN_NAMESPACE bool isDigit(ushort ch)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
static ISC_DATE toDate(QDate t)
static ISC_TIME toTime(QTime t)
QT_BEGIN_NAMESPACE typedef signed char qint8
static double LocalTime(double t, double localTZA)
static int toInt(const QChar &qc, int R)
QTextStream out(stdout)
[7]
\inmodule QtCore \reentrant
static char * convertFromUnicode(char *out, QStringView in, QStringConverter::State *state) noexcept