Fix date arithmetic in isFeedCacheAvailable

This commit is contained in:
2026-01-29 23:27:58 -05:00
parent 91383d8687
commit 13b18b01dd

View File

@@ -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))