summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <[email protected]>2025-07-03 10:48:42 +0200
committerEdward Welbourne <[email protected]>2025-07-04 15:02:22 +0200
commit54dc4c1b9f35fb19b94214f2e48ba518175f32b4 (patch)
treeaf28494c35995662a02d729fa43d022a622a7c4b
parent7d433ad2ea83a20ce7699e79abeb51937c124cfd (diff)
Clarify what we mean by Julian Day in QDate and QDateTime
The formal definition of Julian Day numbers originates with astronomers, so is actually a numbering of UTC nights: the transition from one to the next happens at noon UTC. We, however (like many other non-astronomical users of the numbering), do the transitions at midnight. Make this explicit (while trying not to let it intrude too much in the documentation). Change-Id: I921ef5cb6507a520d0d8853f559abb07e3d2352b Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r--src/corelib/time/qdatetime.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 42011993243..43b16cd0f4f 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -405,13 +405,16 @@ static int fromOffsetString(QStringView offsetString, bool *valid) noexcept
\section2 Range of Valid Dates
- Dates are stored internally as a Julian Day number, an integer count of
- every day in a contiguous range, with 24 November 4714 BCE in the Gregorian
- calendar being Julian Day 0 (1 January 4713 BCE in the Julian calendar).
- As well as being an efficient and accurate way of storing an absolute date,
- it is suitable for converting a date into other calendar systems such as
- Hebrew, Islamic or Chinese. The Julian Day number can be obtained using
- QDate::toJulianDay() and can be set using QDate::fromJulianDay().
+ Dates are stored internally as a modified Julian Day number, an integer
+ count of every day in a contiguous range, with 24 November 4714 BCE in the
+ Gregorian calendar being Julian Day 0 (1 January 4713 BCE in the Julian
+ calendar). As well as being an efficient and accurate way of storing an
+ absolute date, it is suitable for converting a date into other calendar
+ systems such as Hebrew, Islamic or Chinese. For the purposes of QDate,
+ Julian Days are delimited at midnight and, for those of QDateTime, in the
+ zone used by the datetime. (This departs from the formal definition, which
+ delimits Julian Days at UTC noon.) The Julian Day number can be obtained
+ using QDate::toJulianDay() and can be set using QDate::fromJulianDay().
The range of Julian Day numbers that QDate can represent is, for technical
reasons, limited to between -784350574879 and 784354017364, which means from