| Conditions | 1 | 
| Total Lines | 11 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 3 | ||
| Bugs | 1 | Features | 0 | 
| 1 | from struct import Struct | ||
| 22 | def encodeData(self, data): | ||
| 23 | timestamp = time.time() | ||
| 24 | frac, whole = math.modf(timestamp) | ||
| 25 | |||
| 26 | ts_sec = int(whole).to_bytes(4, byteorder='little') | ||
| 27 | ts_usec = int(frac * 1000 * 1000).to_bytes(4, byteorder='little') | ||
| 28 | incl_len = len(data) | ||
| 29 | orig_len = incl_len | ||
| 30 | |||
| 31 |         pcap_packet_header = Struct('<4s4sll').pack(ts_sec, ts_usec, incl_len, orig_len) | ||
| 32 | return pcap_packet_header + data |