You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2019/04/03 21:33:34 UTC
[directory-ldap-api] branch master updated: Fix for DIRAPI-336
This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git
The following commit(s) were added to refs/heads/master by this push:
new 5bb4a03 Fix for DIRAPI-336
5bb4a03 is described below
commit 5bb4a035b588679aa4aa40dd7495e00a096d027e
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Wed Apr 3 23:33:26 2019 +0200
Fix for DIRAPI-336
---
.../apache/directory/api/util/GeneralizedTime.java | 23 ++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java b/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
index de5ff95..4bac31d 100644
--- a/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
+++ b/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
@@ -121,18 +121,21 @@ public class GeneralizedTime implements Comparable<GeneralizedTime>
{
/** Time format with minutes and seconds, excluding fraction. */
YEAR_MONTH_DAY_HOUR_MIN_SEC,
+
/** Time format with minutes and seconds, including fraction. */
YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION,
/** Time format with minutes, seconds are omitted, excluding fraction. */
YEAR_MONTH_DAY_HOUR_MIN,
- /** Time format with minutes seconds are omitted, including fraction. */
+
+ /** Time format with minutes seconds are omitted, including fraction of a minute. */
YEAR_MONTH_DAY_HOUR_MIN_FRACTION,
/** Time format, minutes and seconds are omitted, excluding fraction. */
YEAR_MONTH_DAY_HOUR,
- /** Time format, minutes and seconds are omitted, including fraction. */
- YEAR_MONTH_DAY_HOUR_FRACTION
+
+ /** Time format, minutes and seconds are omitted, including fraction of an hour. */
+ YEAR_MONTH_DAY_HOUR_FRACTION;
}
/**
@@ -885,10 +888,10 @@ public class GeneralizedTime implements Comparable<GeneralizedTime>
else
{
// g-differential
- TimeZone timeZone = clonedCalendar.getTimeZone();
- int rawOffset = timeZone.getRawOffset();
-
- if ( rawOffset < 0 )
+ int offset = clonedCalendar.get( Calendar.ZONE_OFFSET ) + clonedCalendar.get( Calendar.DST_OFFSET );
+
+
+ if ( offset < 0 )
{
result[pos++] = '-';
}
@@ -897,9 +900,9 @@ public class GeneralizedTime implements Comparable<GeneralizedTime>
result[pos++] = '+';
}
- rawOffset = Math.abs( rawOffset );
- hour = rawOffset / ( 60 * 60 * 1000 );
- int minute = ( rawOffset - ( hour * 60 * 60 * 1000 ) ) / ( 1000 * 60 );
+ offset = Math.abs( offset );
+ hour = offset / ( 60 * 60 * 1000 );
+ int minute = ( offset - ( hour * 60 * 60 * 1000 ) ) / ( 1000 * 60 );
// The offset hour
result[pos++] = ( byte ) ( ( hour / 10 ) + '0' );