Skip to content
Snippets Groups Projects
Commit 828bd7ec authored by Bruce Flynn's avatar Bruce Flynn
Browse files

fix and test AquaCucTimecode

parent ffeff4f3
No related branches found
No related tags found
No related merge requests found
......@@ -108,9 +108,10 @@ class AquaCucTimecode(Timecode):
SUB_SECOND_UNITS = 15.2
def day_segmented_timecode(self):
days = self.seconds / 86400
millis = 86400 * (days - int(days)) * 1e3
micros = self.SUB_SECOND_UNITS * self.sub_seconds
seconds = self.seconds + self.leap_seconds
return ((seconds - self.leap_seconds) // 86400, micros // 1e3, micros % 1e3)
return int(days), int(millis), int(micros)
class DaySegmentedTimecode(Timecode):
......
from datetime import datetime
import pytest
from edosl0util import headers
# APID 262 data from 2020-11-29 around 08:50
packet = b'\t\x06Q\x01\x02c\x00\xae%vU\xbdG\x00\x1f\x00\x0c\xe6\x12*\x0c\xc2j\xf0E\x8eBZh\x90s(v\xc6z\xa8}F\x92l\x97\xc0\x99<\xb3h{\xa6\x14\xc6\x0fF\x14\x8a\x0f"j\xf0E\x8cBZh\x86s\x1cv\xc2z\x9e}0\x92v\x97\xc4\x99F\xb3\xbe{\x9e\x17\x16\x11\x9a\x16\xea\x11\x82k\nE\x8aBZh~s\x10v\xb0z\x98}*\x92f\x97\xb2\x99D\xb3\xac{\xb0\x19v\x14\x02\x19J\x13\xeak\x06E\x8eB\\hxs\x02v\xa0z\x86} \x92J\x97\xa4\x99D\xb3\xfa{\xb6\x1b\xde\x16j\x1b\xa2\x16Bj\xf4E\x8cBZhrr\xe8v\x94zz}\n\x92>\x97\x98\x99T\xb4({\xb4\x1e:\x18\xc6\x1e\x06\x18\xa6j\xfaE\x8cBXhhr\xd8v\x86zr|\xfc\x920\x97\x96\x99T\xb3\xe8{\x8e \x8e\x1b& b\x1b\x02j\xbcE\x8cBXhVr\xbevnzR|\xe0\x92"\x97\x90\x99b\xb3\xee{\x06"\xf2\x1d\x92"\xbe\x1djj\xaaE\x8cBZhDr\xa8v\\zD|\xd2\x92\x16\x97\x8e\x99p\xb40z\xaa%F\x1f\xe6%\x1e\x1f\xbej\xc0E\x8cBZh8r\x8avFz(|\xaa\x91\xfe\x97\x92\x99\xa4\xb4\x10{F\'\xaa"6\'~"\x16j\xeeE\x8aB\\h"rZv z\x10|\x9c\x91\xee\x97\xa2\x99\xc6\xb4\x9c|0>\x168\xba>\x168\xb6VPE\x8eBZ[\xb2Z\xd4_\x18b\xdacpr\xf6vzv\xbe\x87,l\x90VPE\x8cB\\[\xb4Z\xcc_\x1cb\xdecvr\xecvrv\xd8\x87@l\x94:\x9a3z=\xb64\xbcW\xcaU\xeea\xe4d\xc4Z$[\xf0_\xccb\xdea0S\x86s\x0eH>[\xaa\\\xa6V\x92\\\x16Y\xb0[xT\xfcg\x16`\x90ap`\xb0^dd\x14Z\xb4]\xec[\xecX\xf4V\x88[\xd6e\x8eh\xfeeze\xc2gh[@[\x96[\xa8[\xb8[\x9c\xc50\x852\x7f\xce\x852\x7f\xcen\xfaE\x8aB\\k\xbcy\xa2}x\x82>\x86\x1a\x9d\xf8\xa3\xba\xa3\x80\xbcP\x82\xd6n\xf6E\x8cBXk\xb2y\xa4}x\x82:\x86\x10\x9d\xee\xa3\xc4\xa3~\xbc\x94\x82\xda\xabR\xa9\xf2\xa9\xf8\xad0\xadB\xaa\xce\xb1\x0e\xab\xce\xaa`\xa7\x1c\xa7\x0c\xa6\xf2\xa7f\xff\xfe\xa5\xc8\xa5\x10\xa7p\xa6\x18\xab\xe4y\xa6\x7f\x88vlB\xf1h\xa2sFv\xe0'
class TestAquaCUCTimecode:
@pytest.mark.parametrize(
"dat,expected",
[
[b"\xae%vU\xbdG\x00\x1f", datetime(2020, 11, 29, 8, 41, 43, 471)],
],
)
def test(self, dat, expected):
t = headers.AquaCucTimecode.from_buffer_copy(dat)
assert t.asdatetime() == expected
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment