stevedlawrence commented on a change in pull request #116: Fix comparison of
calendars that do not have timezones
URL: https://github.com/apache/incubator-daffodil/pull/116#discussion_r213271443
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/calendar/DFDLCalendar.scala
##########
@@ -121,7 +121,8 @@ trait OrderedCalendar { self: DFDLCalendar =>
* can be determined.
*/
private def orderIgnoreTimeZone(p: DFDLDateTime, q: DFDLDateTime):
DFDLCalendarOrder = {
- Assert.invariant((p.hasTimeZone && q.hasTimeZone) || (!p.hasTimeZone &&
!q.hasTimeZone))
+ Assert.invariant(!p.hasTimeZone || p.calendar.getTimeZone ==
TimeZone.GMT_ZONE)
Review comment:
When doing the comparison of two dateTimes, the only fields that are
inspected are year, month, day, hour, minute, and second. So in that sense the
timezone is ignored. Technically, it is not completely ignored though, since
the dateTime is normalized to UTC, so a dateTime with a non-UTC TZ will have
its hours/minutes modified, which are compared.
So this function name ism't completely innacurate. That said, something like
orderCompareFields might be more specific about what it's actually doing, since
all it's really doing is looping over a subset of the fields of a calendar and
comparing them. I'll update the name and comment to be accurate according to
what the method does.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services