Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set file modification time according to UTC #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion elodie/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import re
import shutil
import time
import calendar

from elodie import compatability
from elodie import geolocation
Expand Down Expand Up @@ -628,5 +629,5 @@ def set_utime_from_metadata(self, metadata, file_path):
else:
# We don't make any assumptions about time zones and
# assume local time zone.
date_taken_in_seconds = time.mktime(date_taken)
date_taken_in_seconds = calendar.timegm(date_taken)
os.utime(file_path, (time.time(), (date_taken_in_seconds)))
2 changes: 1 addition & 1 deletion elodie/media/photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_date_taken(self):

exif = self.get_exiftool_attributes()
if not exif:
return seconds_since_epoch
return time.gmtime(seconds_since_epoch)

# We need to parse a string from EXIF into a timestamp.
# EXIF DateTimeOriginal and EXIF DateTime are both stored
Expand Down