You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/05/17 18:05:40 UTC

svn commit: r1339679 - in /jena/Scratch/AFS/Jena-Dev/trunk/src/dev: DevMain.java JENA247_XSDDatimeTzBoundary.java

Author: andy
Date: Thu May 17 16:05:40 2012
New Revision: 1339679

URL: http://svn.apache.org/viewvc?rev=1339679&view=rev
Log: (empty)

Added:
    jena/Scratch/AFS/Jena-Dev/trunk/src/dev/JENA247_XSDDatimeTzBoundary.java
      - copied, changed from r1338575, jena/Scratch/AFS/Jena-Dev/trunk/src/dev/DevMain.java
Removed:
    jena/Scratch/AFS/Jena-Dev/trunk/src/dev/DevMain.java

Copied: jena/Scratch/AFS/Jena-Dev/trunk/src/dev/JENA247_XSDDatimeTzBoundary.java (from r1338575, jena/Scratch/AFS/Jena-Dev/trunk/src/dev/DevMain.java)
URL: http://svn.apache.org/viewvc/jena/Scratch/AFS/Jena-Dev/trunk/src/dev/JENA247_XSDDatimeTzBoundary.java?p2=jena/Scratch/AFS/Jena-Dev/trunk/src/dev/JENA247_XSDDatimeTzBoundary.java&p1=jena/Scratch/AFS/Jena-Dev/trunk/src/dev/DevMain.java&r1=1338575&r2=1339679&rev=1339679&view=diff
==============================================================================
--- jena/Scratch/AFS/Jena-Dev/trunk/src/dev/DevMain.java (original)
+++ jena/Scratch/AFS/Jena-Dev/trunk/src/dev/JENA247_XSDDatimeTzBoundary.java Thu May 17 16:05:40 2012
@@ -24,13 +24,35 @@ import java.util.Calendar ;
 import java.util.Date ;
 import java.util.TimeZone ;
 
-import org.junit.Test ;
-
 import com.hp.hpl.jena.datatypes.xsd.XSDDateTime ;
 
  
-
-public class DevMain {
+/* from
+ * http://mail-archives.apache.org/mod_mbox/jena-users/201205.mbox/%3CF1777BD020462E478F34F38513189F580FC150E8%40NDHV3004.na.corp.mckesson.com%3E
+ * 
+ * which has the proposed fix:
+ * 
+ * 
+ * 
+The XSDDateTime convertCalendar(Calendar date) method, called by
+XSDDateTime(Calendar date), can be changed to produce correct results by
+replacing:
+
+                     cal.add(Calendar.MILLISECOND, -offset);
+
+with:
+
+                     cal.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ */
+
+public class JENA247_XSDDatimeTzBoundary {
+    public static void main(String ... argv) throws Exception
+    {
+        new JENA247_XSDDatimeTzBoundary().test() ;
+    }
+    
+    
     public static Date getDateFromPattern(String ts, String format, String timezoneid) throws Exception {
         return getDateFromPattern(ts, new String[]{format}, TimeZone.getTimeZone(timezoneid));
     }
@@ -52,12 +74,12 @@ public class DevMain {
 
 
 
-    @Test
+    //@Test -- not a test (yet)
     public void test() throws Exception {
         String[] timezonelist = {
-            "GMT",
+//            "GMT",
             "America/New_York",
-            "America/Chicago",
+//            "America/Chicago",
         };
 
         for (String timezoneid : timezonelist) {
@@ -67,17 +89,17 @@ public class DevMain {
                 // 03/11/2012 DST time change at 2 am
                 "03/11/2012 00:29",
                 "03/11/2012 01:29",
-                "03/11/2012 02:29",
-                "03/11/2012 03:29",
-                "03/11/2012 04:29",
-
-                "03/12/2012 01:29",
-                "11/03/2012 23:29",
-                // 11/04/2012 standard time change at 2 am
-                "11/04/2012 00:29",
-                "11/04/2012 01:29",
-                "11/04/2012 02:29",
-                "11/04/2012 03:29",
+//                "03/11/2012 02:29",
+//                "03/11/2012 03:29",
+//                "03/11/2012 04:29",
+//
+//                "03/12/2012 01:29",
+//                "11/03/2012 23:29",
+//                // 11/04/2012 standard time change at 2 am
+//                "11/04/2012 00:29",
+//                "11/04/2012 01:29",
+//                "11/04/2012 02:29",
+//                "11/04/2012 03:29",
             };
 
 
@@ -85,6 +107,9 @@ public class DevMain {
             String format = "MM/dd/yyy HH:mm";
             for (String tstr : sampletimelist){
                 Date dt=getDateFromPattern(tstr, format, timezoneid);
+
+                System.out.println("in DST: "+tz.inDaylightTime(dt)) ;
+                
                 SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");
                 df.setTimeZone(tz);
                 Calendar cal = Calendar.getInstance();