Use time.time() instead of datetime.now() to measure elapsed time.
Both because it is more idiomatic and because we will soon start enforcing that all datetimes in Zulip are timezone aware.
This commit is contained in:
parent
b2ac1bca29
commit
6c47fa77b6
|
@ -38,6 +38,7 @@ import optparse
|
|||
import os
|
||||
import datetime
|
||||
import textwrap
|
||||
import time
|
||||
import signal
|
||||
import logging
|
||||
import hashlib
|
||||
|
@ -762,8 +763,8 @@ def maybe_forward_to_zephyr(message):
|
|||
# Don't try forward private messages with non-MIT users
|
||||
# to MIT Zephyr.
|
||||
return
|
||||
timestamp_now = datetime.datetime.now().strftime("%s")
|
||||
if float(message["timestamp"]) < float(timestamp_now) - 15:
|
||||
timestamp_now = int(time.time())
|
||||
if float(message["timestamp"]) < timestamp_now - 15:
|
||||
logger.warning("Skipping out of order message: %s < %s" %
|
||||
(message["timestamp"], timestamp_now))
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue