< prev index next >
src/java.base/share/classes/java/time/format/Parsed.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 592,610 ****
}
}
private void resolveInstant() {
// add instant seconds if we have date, time and zone
if (date != null && time != null) {
- if (zone != null) {
- long instant = date.atTime(time).atZone(zone).getLong(ChronoField.INSTANT_SECONDS);
- fieldValues.put(INSTANT_SECONDS, instant);
- } else {
Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
if (offsetSecs != null) {
ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
! long instant = date.atTime(time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
fieldValues.put(INSTANT_SECONDS, instant);
}
}
}
}
--- 592,611 ----
}
}
private void resolveInstant() {
// add instant seconds if we have date, time and zone
+ // Offset (if present) will be given priority over the zone.
if (date != null && time != null) {
Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
if (offsetSecs != null) {
ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
! long instant = date.atTime(time).atZone(offset).toEpochSecond();
! fieldValues.put(INSTANT_SECONDS, instant);
! } else {
! if (zone != null) {
! long instant = date.atTime(time).atZone(zone).toEpochSecond();
fieldValues.put(INSTANT_SECONDS, instant);
}
}
}
}
< prev index next >