Skip to content

Instantly share code, notes, and snippets.

@brennv
Created May 21, 2016 18:24
Show Gist options
  • Save brennv/a68196d68a610875b7d09490eeef1ba1 to your computer and use it in GitHub Desktop.
Save brennv/a68196d68a610875b7d09490eeef1ba1 to your computer and use it in GitHub Desktop.
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