drop undocumented dependency on dateutil (#4266)

It turns out we were relying on dateutil being pulled in transitively by
pysaml2. There's no need for that bloat.
This commit is contained in:
Richard van der Hoff 2018-12-05 18:52:42 +01:00 committed by Amber Brown
parent e8d98466b0
commit 9a3e24a13d
2 changed files with 7 additions and 7 deletions

1
changelog.d/4266.misc Normal file
View File

@ -0,0 +1 @@
drop undocumented dependency on dateutil

View File

@ -14,12 +14,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import datetime import calendar
import logging import logging
import time import time
from dateutil import tz
from synapse.api.constants import PresenceState from synapse.api.constants import PresenceState
from synapse.storage.devices import DeviceStore from synapse.storage.devices import DeviceStore
from synapse.storage.user_erasure_store import UserErasureStore from synapse.storage.user_erasure_store import UserErasureStore
@ -357,10 +355,11 @@ class DataStore(RoomMemberStore, RoomStore,
""" """
Returns millisecond unixtime for start of UTC day. Returns millisecond unixtime for start of UTC day.
""" """
now = datetime.datetime.utcnow() now = time.gmtime()
today_start = datetime.datetime(now.year, now.month, today_start = calendar.timegm((
now.day, tzinfo=tz.tzutc()) now.tm_year, now.tm_mon, now.tm_mday, 0, 0, 0,
return int(time.mktime(today_start.timetuple())) * 1000 ))
return today_start * 1000
def generate_user_daily_visits(self): def generate_user_daily_visits(self):
""" """