Handle "Z" as EXIF offset time (#881)

This commit is contained in:
Ferdia McKeogh
2022-12-24 15:19:36 +00:00
committed by GitHub
parent 89f82e92f0
commit 9a9a1be165

View File

@@ -41,6 +41,11 @@ ExifDateTime = namedtuple(
def exif_offset_to_seconds(offset: str) -> int:
"""Convert timezone offset from UTC in exiftool format (+/-hh:mm) to seconds"""
# Z (for Zulu time) corresponds to a zero UTC offset
if offset == "Z":
return 0
sign = 1 if offset[0] == "+" else -1
hours, minutes = offset[1:].split(":")
return sign * (int(hours) * 3600 + int(minutes) * 60)