diff options
-rw-r--r-- | changelog.d/4266.misc | 1 | ||||
-rw-r--r-- | synapse/storage/__init__.py | 13 |
2 files changed, 7 insertions, 7 deletions
diff --git a/changelog.d/4266.misc b/changelog.d/4266.misc new file mode 100644 index 0000000000..67fbde7484 --- /dev/null +++ b/changelog.d/4266.misc @@ -0,0 +1 @@ +drop undocumented dependency on dateutil diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index b23fb7e56c..24329879e5 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -14,12 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import datetime +import calendar import logging import time -from dateutil import tz - from synapse.api.constants import PresenceState from synapse.storage.devices import DeviceStore from synapse.storage.user_erasure_store import UserErasureStore @@ -357,10 +355,11 @@ class DataStore(RoomMemberStore, RoomStore, """ Returns millisecond unixtime for start of UTC day. """ - now = datetime.datetime.utcnow() - today_start = datetime.datetime(now.year, now.month, - now.day, tzinfo=tz.tzutc()) - return int(time.mktime(today_start.timetuple())) * 1000 + now = time.gmtime() + today_start = calendar.timegm(( + now.tm_year, now.tm_mon, now.tm_mday, 0, 0, 0, + )) + return today_start * 1000 def generate_user_daily_visits(self): """ |