diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-12-22 18:18:20 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-12-22 18:18:20 +0100 |
commit | 12fe3dd984c4526062c8fe426b05f1789dfe8b74 (patch) | |
tree | 3d5a52e1bf25ece253364c4544fbc7ee65d1691c /src | |
parent | cbf24e672c0111e2b3982188e5d88dc9fe8421b4 (diff) | |
parent | 59ee4d6f36aaaea03dc9ffcacaf338903392db06 (diff) | |
download | pyexiv2-12fe3dd984c4526062c8fe426b05f1789dfe8b74.tar.gz |
Merged the latest changes from the trunk.
Diffstat (limited to 'src')
-rw-r--r-- | src/pyexiv2/iptc.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pyexiv2/iptc.py b/src/pyexiv2/iptc.py index 1e5429e..128f77e 100644 --- a/src/pyexiv2/iptc.py +++ b/src/pyexiv2/iptc.py @@ -346,11 +346,16 @@ class IptcTag(ListenerInterface): elif self.type == 'Time': if isinstance(value, (datetime.time, datetime.datetime)): - r = value.strftime('%H%M%S') - if value.tzinfo is not None: - r += value.strftime('%z') + # According to the IPTC specification, the format for a string + # field representing a time is '%H%M%S±%H%M'. However, the + # string expected by exiv2's TimeValue::read(string) should be + # formatted using pattern '%H:%M:%S±%H:%M'. + r = value.strftime('%H:%M:%S') + if value.tzinfo is not None and \ + not (value.tzinfo.hours == 0 and value.tzinfo.minutes == 0): + r += value.strftime('%Z') else: - r += '+0000' + r += '+00:00' return r else: raise IptcValueError(value, self.type) |