Skip to content

Commit

Permalink
Reuse epoch object instead if making a new object. (#1919)
Browse files Browse the repository at this point in the history
Reuse epoch object for perf
  • Loading branch information
vEpiphyte committed Oct 22, 2020
1 parent bd0d395 commit 5117134
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion synapse/lib/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def repr(tick, pack=False):
if tick == 0x7fffffffffffffff:
return '?'

dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(milliseconds=tick)
dt = EPOCH + datetime.timedelta(milliseconds=tick)
millis = dt.microsecond / 1000
if pack:
return '%d%.2d%.2d%.2d%.2d%.2d%.3d' % (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, millis)
Expand Down

0 comments on commit 5117134

Please sign in to comment.