Skip to content

Commit

Permalink
Adds suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Nov 1, 2023
1 parent e222007 commit 54753cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/com/amazon/ion/impl/bin/IonEncoder_1_1.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ public static int writeTimestampValue(WriteBuffer buffer, Timestamp value) {
}

// Condition 2: The fractional seconds are a common precision.
int secondsScale = value.getDecimalSecond().scale();
if (secondsScale != 0 && secondsScale != 3 && secondsScale != 6 && secondsScale != 9) {
return writeLongFormTimestampValue(buffer, value);
if (value.getFractionalSecond() != null) {
int secondsScale = value.getFractionalSecond().scale();
if (secondsScale != 0 && secondsScale != 3 && secondsScale != 6 && secondsScale != 9) {
return writeLongFormTimestampValue(buffer, value);
}
}
// Condition 3: The local offset is either UTC, unknown, or falls between -14:00 to +14:00 and is divisible by 15 minutes.
Integer offset = value.getLocalOffset();
Expand Down

0 comments on commit 54753cc

Please sign in to comment.