Skip to content

Commit

Permalink
Fix for DIRAPI-336
Browse files Browse the repository at this point in the history
  • Loading branch information
elecharny committed Apr 3, 2019
1 parent 5b93e10 commit 5bb4a03
Showing 1 changed file with 13 additions and 10 deletions.
Expand Up @@ -121,18 +121,21 @@ public enum Format
{
/** 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;
}

/**
Expand Down Expand Up @@ -885,10 +888,10 @@ public String toGeneralizedTime( Format format, FractionDelimiter fractionDelimi
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++] = '-';
}
Expand All @@ -897,9 +900,9 @@ public String toGeneralizedTime( Format format, FractionDelimiter fractionDelimi
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' );
Expand Down

0 comments on commit 5bb4a03

Please sign in to comment.