axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r673389 - in /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding: types/Time.java utils/ConverterUtil.java
Date Wed, 02 Jul 2008 13:38:13 GMT
Author: amilas
Date: Wed Jul  2 06:38:12 2008
New Revision: 673389

URL: http://svn.apache.org/viewvc?rev=673389&view=rev
Log:
set the day light saving time for ADB

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java?rev=673389&r1=673388&r2=673389&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java
Wed Jul  2 06:38:12 2008
@@ -99,11 +99,13 @@
         source = source.trim();
 
         Calendar calendar = Calendar.getInstance();
+        int dsTimeOffset = calendar.get(Calendar.DST_OFFSET);
         calendar.clear();
         int hour = 0;
         int minite = 0;
         int second = 0;
         int miliSecond = 0;
+
         int timeZoneOffSet = TimeZone.getDefault().getRawOffset();
          int milliSecondPartLength = 0;
         if (source.length() >= 8) {
@@ -195,7 +197,8 @@
         }
         calendar.set(Calendar.MILLISECOND, miliSecond);
 
-        calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet);
+        calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet - dsTimeOffset);
+        calendar.set(Calendar.DST_OFFSET, dsTimeOffset);
 
         return calendar;
     }

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java?rev=673389&r1=673388&r2=673389&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
Wed Jul  2 06:38:12 2008
@@ -608,12 +608,14 @@
         }
 
         Calendar calendar = Calendar.getInstance();
+        int dsTimeOffset = calendar.get(Calendar.DST_OFFSET);
         calendar.clear();
         calendar.set(Calendar.YEAR, year);
         //xml month stars from the 1 and calendar month is starts with 0
         calendar.set(Calendar.MONTH, month - 1);
         calendar.set(Calendar.DAY_OF_MONTH, day);
-        calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet);
+        calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet - dsTimeOffset);
+        calendar.set(Calendar.DST_OFFSET, dsTimeOffset);
         calendar.getTimeInMillis();
         if (bc){
             calendar.set(Calendar.ERA, GregorianCalendar.BC);
@@ -866,8 +868,10 @@
         // '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
         Date date = null;
         Calendar calendar = Calendar.getInstance();
+        int dsTimeOffset = calendar.get(Calendar.DST_OFFSET);
         calendar.clear();
 
+
         if (source.startsWith("-")) {
             source = source.substring(1);
             calendar.set(Calendar.ERA, GregorianCalendar.BC);
@@ -980,7 +984,10 @@
                 }
             }
             calendar.set(Calendar.MILLISECOND, miliSecond);
-            calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet);
+            calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet - dsTimeOffset);
+            calendar.set(Calendar.DST_OFFSET, dsTimeOffset);
+
+
 
         } else {
             throw new NumberFormatException("date string can not be less than 19 charactors");



Mime
View raw message