Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

#!/usr/bin/env python 

# -*- coding: utf-8 -*- 

""" Packet base class. 

 

Todo: 

* Implement location. 

 

""" 

 

# Standard Library 

import logging 

 

from time import time 

from datetime import datetime 

 

# Local 

 

 

__copyright__ = "Finding Ray" 

__license__ = "gpl3" 

 

_logger = logging.getLogger(__name__) 

 

class Packet(object): 

""" Initialization of attributes common to all packets. 

 

Attributes: 

unix_time (float): packet creation time in seconds since UNIX epoch. 

timestamp (str): packet creation time human readable format. 

location: location packet was received. 

 

""" 

def __init__(self): 

self.unix_time = time() 

self.timestamp = datetime.utcnow() 

self.location = "location stub"