[Jython-checkins] jython: Make the calendar used by the time module Gregorian proleptic.
jeff.allen
jython-checkins at python.org
Sun May 20 14:14:58 EDT 2018
https://hg.python.org/jython/rev/db9b69e4e8ef
changeset: 8165:db9b69e4e8ef
user: Tom Bech <tom.bech at bouvet.no>
date: Sun May 20 17:24:18 2018 +0100
summary:
Make the calendar used by the time module Gregorian proleptic.
Change to match CPython behaviour.
files:
src/org/python/modules/time/Time.java | 17 +++++++++-----
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/org/python/modules/time/Time.java b/src/org/python/modules/time/Time.java
--- a/src/org/python/modules/time/Time.java
+++ b/src/org/python/modules/time/Time.java
@@ -226,12 +226,15 @@
}
private static GregorianCalendar _tupletocal(PyTuple tup) {
- return new GregorianCalendar(item(tup, 0),
- item(tup, 1),
- item(tup, 2),
- item(tup, 3),
- item(tup, 4),
- item(tup, 5));
+ GregorianCalendar gc = new GregorianCalendar(item(tup, 0),
+ item(tup, 1),
+ item(tup, 2),
+ item(tup, 3),
+ item(tup, 4),
+ item(tup, 5));
+
+ gc.setGregorianChange(new Date(Long.MIN_VALUE));
+ return gc;
}
public static double mktime(PyTuple tup) {
@@ -254,6 +257,8 @@
protected static PyTimeTuple _timefields(double secs, TimeZone tz) {
GregorianCalendar cal = new GregorianCalendar(tz);
cal.clear();
+ cal.setGregorianChange(new Date(Long.MIN_VALUE));
+
secs = secs * 1000;
if (secs < Long.MIN_VALUE || secs > Long.MAX_VALUE) {
throw Py.ValueError("timestamp out of range for platform time_t");
--
Repository URL: https://hg.python.org/jython
More information about the Jython-checkins
mailing list