Fix date arithmetic in isFeedCacheAvailable
This commit is contained in:
@@ -249,9 +249,9 @@ class NewsFeed:
|
|||||||
modifiedTime=os.path.getmtime(pathFileName)
|
modifiedTime=os.path.getmtime(pathFileName)
|
||||||
convertTime=time.localtime(modifiedTime)
|
convertTime=time.localtime(modifiedTime)
|
||||||
formatTime=time.strftime('%d%m%Y %H:%M:%S',convertTime)
|
formatTime=time.strftime('%d%m%Y %H:%M:%S',convertTime)
|
||||||
fileDateTime=DateTimeHelper.strptime(formatTime,'%d%m%Y %H:%M:%S')
|
fileDateTime=time.strptime(formatTime,'%d%m%Y %H:%M:%S')
|
||||||
currentTime=datetime.now()
|
currentTime=datetime.now()
|
||||||
timedelta=currentTime-fileDateTime
|
timedelta=currentTime-datetime(*(fileDateTime[0:6]))
|
||||||
hours, hremainder = divmod(timedelta.seconds,3600)
|
hours, hremainder = divmod(timedelta.seconds,3600)
|
||||||
minutes, mremainder = divmod(timedelta.seconds,60)
|
minutes, mremainder = divmod(timedelta.seconds,60)
|
||||||
self.writeLog('file is = "{age}" hours old'.format(age=hours))
|
self.writeLog('file is = "{age}" hours old'.format(age=hours))
|
||||||
|
|||||||
Reference in New Issue
Block a user