Skip to content

Commit

Permalink
Fix unpacking of negative timestamps from msgpack
Browse files Browse the repository at this point in the history
- Update the work of PR influxdata#734 to correctly interpret negative timestamps
  • Loading branch information
bitoffdev committed Aug 22, 2020
1 parent fc0235e commit 0031e4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def _parse_netloc(netloc):

def _msgpack_parse_hook(code, data):
if code == 5:
(epoch_s, epoch_ns) = struct.unpack(">QI", data)
(epoch_s, epoch_ns) = struct.unpack(">qI", data)
timestamp = datetime.datetime.utcfromtimestamp(epoch_s)
timestamp += datetime.timedelta(microseconds=(epoch_ns / 1000))
return timestamp.isoformat() + 'Z'
Expand Down

0 comments on commit 0031e4d

Please sign in to comment.