Use local timezone
This commit is contained in:
parent
2c58b4a576
commit
371bec6227
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
Copyright (c) 2020 Solderpunk. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
|
|
@ -113,7 +113,8 @@ def get_update_time(filename, time_func):
|
|||
basename = os.path.basename(filename)
|
||||
if re.search("^[0-9]{4}-[01][0-9]-[0-3][0-9]", basename):
|
||||
date = basename[0:10] + " Z" # Add UTC marker
|
||||
return datetime.datetime.strptime(date, "%Y-%m-%d %z")
|
||||
# Put in user's local timezone
|
||||
return datetime.datetime.strptime(date, "%Y-%m-%d %z").replace(tzinfo=datetime.timezone.utc).astimezone(tz=None)
|
||||
else:
|
||||
updated = time_func(filename)
|
||||
return datetime.datetime.fromtimestamp(updated, tz=datetime.timezone.utc)
|
||||
|
|
Loading…
Reference in New Issue