jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1346906 - /jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDateTime.java
Date Wed, 06 Jun 2012 14:20:43 GMT
Author: andy
Date: Wed Jun  6 14:20:43 2012
New Revision: 1346906

URL: http://svn.apache.org/viewvc?rev=1346906&view=rev
Log:
Reset

Modified:
    jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDateTime.java

Modified: jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDateTime.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDateTime.java?rev=1346906&r1=1346905&r2=1346906&view=diff
==============================================================================
--- jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDateTime.java (original)
+++ jena/trunk/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDateTime.java Wed
Jun  6 14:20:43 2012
@@ -130,9 +130,14 @@ public class XSDDateTime extends Abstrac
      */
     private static int[] convertCalendar(Calendar date) {
         int[] data = new int[TOTAL_SIZE];
-        
-        Calendar cal = (Calendar)date.clone();
-        cal.setTimeZone(TimeZone.getTimeZone("GMT"));   // Rebase to GMT.
+
+        int offset = date.get(Calendar.ZONE_OFFSET) + date.get(Calendar.DST_OFFSET);
+                                        //  Thanks to Greg Shueler for pointing out need
for DST offset
+        Calendar cal = date;
+        if (offset != 0) {
+            cal = (Calendar)date.clone();
+            cal.add(Calendar.MILLISECOND, -offset);
+        }
         
         data[AbstractDateTime.CY] = cal.get(Calendar.YEAR);
         data[AbstractDateTime.M] = cal.get(Calendar.MONTH) + 1;



Mime
View raw message