From 823a390c16a417eab58641311cc1c83fd1eaf4df Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 12 Jan 2020 21:41:49 +0000 Subject: [PATCH] timezone --- schedule.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/schedule.py b/schedule.py index 91963a408..21007bd5d 100644 --- a/schedule.py +++ b/schedule.py @@ -57,7 +57,6 @@ def updatePostSchedule(baseDir: str,handle: str,httpd,maxScheduledPosts: int) -> if ' ' not in line: continue dateStr=line.split(' ')[0] - print('DEBUG: schedule date='+dateStr) if 'T' not in dateStr: continue postId=line.split(' ',1)[1].replace('\n','') @@ -71,10 +70,9 @@ def updatePostSchedule(baseDir: str,handle: str,httpd,maxScheduledPosts: int) -> # create the new index file indexLines.append(line) # convert string date to int - if '+' in dateStr: - dateStr=dateStr.split('+')[0]+'Z' + print('DEBUG: schedule date='+dateStr) postTime= \ - datetime.datetime.strptime(dateStr,"%Y-%m-%dT%H:%M:%S%z") + datetime.datetime.strptime(dateStr,"%Y-%m-%dT%H:%M:%S%z").replace(tzinfo=None) postDaysSinceEpoch= \ (postTime - datetime.datetime(1970,1,1)).days print('DEBUG: schedule postTime='+str(int(postTime)))