Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

drop undocumented dependency on dateutil #4266

Merged
merged 1 commit into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4266.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drop undocumented dependency on dateutil
13 changes: 6 additions & 7 deletions synapse/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -357,10 +355,11 @@ def _get_start_of_day(self):
"""
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):
"""
Expand Down