Created
May 21, 2016 18:24
-
-
Save brennv/a68196d68a610875b7d09490eeef1ba1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
from datetime import datetime, timedelta | |
from tzlocal import get_localzone | |
def check_file_time_elpased(file_path): | |
ctime = time.ctime(os.path.getmtime(file_path)) | |
last_updated = datetime.strptime(ctime), "%a %b %d %H:%M:%S %Y") | |
tz = get_localzone() | |
then = tz.normalize(tz.localize(last_updated)) | |
now = datetime.now(tz) | |
return (now - then) > timedelta(1) # hour |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment