File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,16 +34,13 @@ def test_time_producer(self):
3434 self .assertEqual (days , int (current_in_epoch ) // canopen .timestamp .ONE_DAY )
3535 self .assertEqual (ms , int ((current_in_epoch % canopen .timestamp .ONE_DAY ) * 1000 ))
3636
37- # Test providing a timestamp
38- faketime = 1_927_999_438 # 2031-02-04 20 :23:58
37+ # Provide a specific time to verify the proper encoding
38+ faketime = 1_927_999_438 # 2031-02-04 19 :23:58
3939 producer .transmit (faketime )
4040 msg = network .bus .recv (1 )
4141 self .assertEqual (msg .arbitration_id , 0x100 )
4242 self .assertEqual (msg .dlc , 6 )
43- ms , days = canopen .timestamp .TIME_OF_DAY_STRUCT .unpack (msg .data )
44- current_in_epoch = faketime - epoch
45- self .assertEqual (days , int (current_in_epoch ) // canopen .timestamp .ONE_DAY )
46- self .assertEqual (ms , int ((current_in_epoch % canopen .timestamp .ONE_DAY ) * 1000 ))
43+ self .assertEqual (msg .data , b"\xb0 \xa4 \x29 \x04 \x31 \x43 " )
4744
4845 network .disconnect ()
4946
You can’t perform that action at this time.
0 commit comments