Skip to content

Commit

Permalink
fix(source): Fixed the parse binary timestamp bug: added parse intege…
Browse files Browse the repository at this point in the history
…r step for the seconds portion

The existing implementation parses the seconds portion of the timestamp as a whole decimal number,
whereas the seconds portion is actually encoded as an integer portion plus an fractional portion.
Therefore, the seconds portion should be first parsed as an integer, and if there is additional data
in the span (i.e. the fraction portion), the remaining data should then be parsed as a decimal
number same as the existing implementation.
  • Loading branch information
msiyangamzn authored and therapon committed Jun 25, 2017
1 parent c6ed974 commit e48d178
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/IonParserBinaryRaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,11 @@ function read_timestamp_value(span: Span, len: number) : Timestamp {
minutes = read_var_unsigned_int(span);
if (span.position() >= end) break;

seconds = read_decimal_value(span, end - span.position());
seconds = read_var_unsigned_int(span);
precision = Precision.SECONDS;
if (span.position() >= end) break;

seconds += read_decimal_value(span, end - span.position());
break;
}
}
Expand Down

0 comments on commit e48d178

Please sign in to comment.