Properly handle midnight tweets

This commit is contained in:
Klaus-Uwe Mitterer 2017-02-24 00:14:23 +01:00
parent 2e4cd0207d
commit 010b1198da

View file

@ -38,7 +38,7 @@ def markovifyText(text):
def getTime(now = datetime.datetime.now()):
thenminute = 15 if now.minute < 15 else 30 if now.minute < 30 else 45 if now.minute < 45 else 0
thenhour = now.hour + 1 if thenminute == 0 else now.hour
thenhour = (now.hour + 1 if now.hour < 23 else 0) if thenminute == 0 else now.hour
then = datetime.datetime(now.year, now.month, now.day, thenhour, thenminute, 0)
return (then - datetime.datetime.now()).seconds