Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commitfa1e7e7

Browse files
committed
Fix unpacking of negative timestamps from msgpack
1 parent7b03673 commitfa1e7e7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎influxdb/client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ def _parse_netloc(netloc):
12441244

12451245
def_msgpack_parse_hook(code,data):
12461246
ifcode==5:
1247-
(epoch_s,epoch_ns)=struct.unpack(">QI",data)
1247+
(epoch_s,epoch_ns)=struct.unpack(">qi",data)
12481248
timestamp=datetime.datetime.utcfromtimestamp(epoch_s)
12491249
timestamp+=datetime.timedelta(microseconds=(epoch_ns/1000))
12501250
returntimestamp.isoformat()+'Z'

‎influxdb/tests/client_test.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ def test_query_msgpack(self):
575575
example_response=bytes(bytearray.fromhex(
576576
"81a7726573756c74739182ac73746174656d656e745f696400a673657269"
577577
"65739183a46e616d65a161a7636f6c756d6e7392a474696d65a176a67661"
578-
"6c7565739192c70c05000000005d26178a019096c8cb3ff0000000000000"
578+
"6c7565739292c70c05000000005d26178a019096c8cb3ff0000000000000"
579+
"92c70c05fffffffffffee6c0ff439eb2cb4000000000000000"
579580
))
580581

581582
withrequests_mock.Mocker()asm:
@@ -590,7 +591,10 @@ def test_query_msgpack(self):
590591

591592
self.assertListEqual(
592593
list(rs.get_points()),
593-
[{'v':1.0,'time':'2019-07-10T16:51:22.026253Z'}]
594+
[
595+
{"v":1.0,"time":"2019-07-10T16:51:22.026253Z"},
596+
{"v":2.0,"time":"1969-12-31T03:59:59.987654Z"},
597+
],
594598
)
595599

596600
deftest_select_into_post(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp