diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-09-15 06:27:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-09-15 06:27:39 (GMT) |
commit | 7539841ffd6ed3122986a4aef9fc0b60e477c607 (patch) | |
tree | c6bd2858a3640b4ce87297c427f1c80a1cf177ce /generic | |
parent | 1cee49ead8bc5aef05af90885883c758e46f928c (diff) | |
parent | 39c9ae29d9fb0b0f6935081aae95607f8d2de414 (diff) | |
download | tcl-7539841ffd6ed3122986a4aef9fc0b60e477c607.zip tcl-7539841ffd6ed3122986a4aef9fc0b60e477c607.tar.gz tcl-7539841ffd6ed3122986a4aef9fc0b60e477c607.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclClock.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index 39fb073..4f97cb9 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -447,11 +447,13 @@ ClockGetdatefieldsObjCmd( } /* - * Extract Julian day. + * Extract Julian day. Always round the quotient down by subtracting 1 + * when the remainder is negative (i.e. if the quotient was rounded up). */ - fields.julianDay = (int) ((fields.localSeconds + JULIAN_SEC_POSIX_EPOCH) - / SECONDS_PER_DAY); + fields.julianDay = (int) ((fields.localSeconds / SECONDS_PER_DAY) - + ((fields.localSeconds % SECONDS_PER_DAY) < 0) + + JULIAN_DAY_POSIX_EPOCH); /* * Convert to Julian or Gregorian calendar. |