| 3565 | self.custom_scaling = custom_scaling |
| 3566 | |
| 3567 | def i2repr(self, pkt, x): |
| 3568 | # type: (Optional[Packet], float) -> str |
| 3569 | if x is None: |
| 3570 | x = time.time() - self.delta |
| 3571 | elif self.use_msec: |
| 3572 | x = x / 1e3 |
| 3573 | elif self.use_micro: |
| 3574 | x = x / 1e6 |
| 3575 | elif self.use_nano: |
| 3576 | x = x / 1e9 |
| 3577 | elif self.custom_scaling: |
| 3578 | x = x / self.custom_scaling |
| 3579 | x += self.delta |
| 3580 | # To make negative timestamps work on all plateforms (e.g. Windows), |
| 3581 | # we need a trick. |
| 3582 | t = ( |
| 3583 | datetime.datetime(1970, 1, 1) + |
| 3584 | datetime.timedelta(seconds=x) |
| 3585 | ).strftime(self.strf) |
| 3586 | return "%s (%d)" % (t, int(x)) |
| 3587 | |
| 3588 | def i2m(self, pkt, x): |
| 3589 | # type: (Optional[Packet], Optional[float]) -> int |