Skip to content

Commit

Permalink
https://github.com/nakagami/pyfirebirdsql/issues/114
Browse files Browse the repository at this point in the history
  • Loading branch information
nakagami committed Jan 4, 2025
1 parent 051f354 commit bcab119
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/efirebirdsql_conv.erl
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,27 @@ parse_timestamp(RawValue) ->
-spec parse_time_tz(binary()) -> {{integer(), integer(), integer(), integer()}, binary(), binary()}.
parse_time_tz(RawValue) ->
<<HMSN:4/binary, TimeZoneID:16, OffsetID:16>> = RawValue,
TimeZone = maps:get(TimeZoneID, efirebirdsql_tz_map:timezone_name_by_id()),
Offset = maps:get(OffsetID, efirebirdsql_tz_map:timezone_name_by_id()),
case TimeZoneID of
0 ->
TimeZone = "UTC",
Offset = "UTC";
_ ->
TimeZone = maps:get(TimeZoneID, efirebirdsql_tz_map:timezone_name_by_id()),
Offset = maps:get(OffsetID, efirebirdsql_tz_map:timezone_name_by_id())
end,
{parse_time(HMSN), TimeZone, Offset}.

-spec parse_timestamp_tz(binary()) -> {{integer(), integer(), integer()}, {integer(), integer(), integer(), integer()}, binary(), binary()}.
parse_timestamp_tz(RawValue) ->
<<YMD:4/binary, HMSN:4/binary, TimeZoneID:16, OffsetID:16>> = RawValue,
TimeZone = maps:get(TimeZoneID, efirebirdsql_tz_map:timezone_name_by_id()),
Offset = maps:get(OffsetID, efirebirdsql_tz_map:timezone_name_by_id()),
case TimeZoneID of
0 ->
TimeZone = "UTC",
Offset = "UTC";
_ ->
TimeZone = maps:get(TimeZoneID, efirebirdsql_tz_map:timezone_name_by_id()),
Offset = maps:get(OffsetID, efirebirdsql_tz_map:timezone_name_by_id())
end,
{parse_date(YMD), parse_time(HMSN), TimeZone, Offset}.

fill0(S, 0) -> S;
Expand Down

0 comments on commit bcab119

Please sign in to comment.