mbeckerle commented on a change in pull request #157: Add support for type 
aware checking in the TDML runner
URL: https://github.com/apache/incubator-daffodil/pull/157#discussion_r241902138
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DFDLFunctions.scala
 ##########
 @@ -114,10 +114,20 @@ case class DFDLTimeZoneFromDFDLCalendar(recipe: 
CompiledDPath, argType: NodeInfo
   extends FNOneArg(recipe, argType) {
 
   override def computeValue(value: AnyRef, dstate: DState) = {
-    val calendar = value.asInstanceOf[DFDLCalendar]
-
-    val res = if (calendar.hasTimeZone) { calendar.getTimeZoneString } else { 
"" }
-    res
+    val dfdlcal = value.asInstanceOf[DFDLCalendar]
+    if (dfdlcal.hasTimeZone) {
+      val tz = dfdlcal.calendar.getTimeZone
+      val offsetInMils = tz.getRawOffset
+      val offsetInMins = Math.abs(offsetInMils / (1000 * 60))
+      val hour = offsetInMins / 60
+      val mins = offsetInMins % 60
+
+      val signStr = if (offsetInMils >= 0) "+" else "-"
+      val hourStr = if (hour < 10) "0" + hour else hour
+      val minsStr = if (mins < 10) "0" + mins else mins
+
+      signStr + hourStr + ":" + minsStr
 
 Review comment:
   Right here is where we'd change to use "Z" notation instead of more verbose 
"+00:00". 
   
   We should consider this. I think people expect it, or at least find it less 
objectionable than "+00:00".

----------------------------------------------------------------
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

Reply via email to