While correcting the time in a set of CR2 and XMP files, I noticed that my XMP files sometimes ended up with the wrong time. I have not verified yet if my CR2 files have the same problem.
I can reproduce the problem like this:
Create an empty directory
Copy the two attached XMP files in this directory, name them file1.XMP and file2.XMP (the file names do not seem to matter)
Run the following:
exiftool -v5 -datetimedigitized-=0:0:5 file?.xmp
This is the result (note the time that is not shifted by exactly 5 seconds in file2.xmp)
Shifting XMP-exif:DateTimeDigitized if tag exists
======== file1.xmp
Rewriting file1.xmp...
FileType = XMP
MIMEType = application/rdf+xml
- XMP-exif:DateTimeDigitized = '2010-07-28T15:35:57.59-04:00'
+ XMP-exif:DateTimeDigitized = '2010-07-28T15:35:52.59-04:00'
======== file2.xmp
Rewriting file2.xmp...
FileType = XMP
MIMEType = application/rdf+xml
- XMP-exif:DateTimeDigitized = '2010-07-28T15:40:38.37-04:00'
+ XMP-exif:DateTimeDigitized = '2010-07-28T15:40:32.63-04:00'
2 image files updated
If, under the same original conditions, I shift the time in only the second file:
exiftool -v5 -datetimedigitized-=0:0:5 file2.xmp
The time is shifted correctly, by exactly 5 seconds:
Shifting XMP-exif:DateTimeDigitized if tag exists
======== file2.xmp
Rewriting file2.xmp...
FileType = XMP
MIMEType = application/rdf+xml
- XMP-exif:DateTimeDigitized = '2010-07-28T15:40:38.37-04:00'
+ XMP-exif:DateTimeDigitized = '2010-07-28T15:40:33.37-04:00'
1 image files updated
My environment:
>uname -a
CYGWIN_NT-5.1 borduas 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
>exiftool -ver
8.40
Thanks for any explanation, workaround or fix.
Martin
Hi Martin,
You get the prize for discovering a bug in ExifTool!
Thank you very much for pointing this out. The problem only occurs when shifting multiple date/time values with fractional seconds.
This will be fixed in the next release.
- Phil
Phil,
The fix is enough of a prize. Thanks!
I regularly shift time by a few seconds in pictures taken with multiple cameras, to maintain a coherent timeline across multiple sets. I guess I now have many, many pictures with incorrect dates, and I deleted the originals months ago.
Do you know if:
1. this bug has always been in ExifTool?
2. the time error is limited (a second or less) or completely random?
Thanks,
Martin
Hi Martin,
The time error is due to a bug in the handling of the fractional seconds, and does not affect times with integer seconds. The maximum error for affected times due to this bug should be 2 seconds.
You may be able to compare affected date/time values with other values in the same file to determine the correct time. Only XMP date/time values could be affected since other formats (EXIF and IPTC for example) do not support fractional seconds in the time string.
I apologize for any inconvenience this bug causes, and thank you again for pointing out this problem.
- Phil
Edit: I forgot about the GPS:TimeStamp tag which also supports fractional seconds. I think this is the only non-XMP tag which could be affected.
Hi Martin,
I have prepared a pre-release of the Perl version of Image-ExifTool-8.41, available for download here (https://exiftool.org/Image-ExifTool-8.41p.tar.gz).
If would be helpful if you are able to test this out.
Thanks.
- Phil
Hi Phil,
I just tested 8.41 on about a dozen files, compared the dates after a negative shift of 5 seconds, and it seems to work properly. Thanks!
My Canon XSi does seem to generate fractional time, but not in a native tag, only in a composite, if that's what you mean by "do not support fractional seconds in the time string".
exiftool -*date* -G file_0003.cr2
[File] File Modification Date/Time : 2010:07:28 14:40:40-04:00
[EXIF] Modify Date : 2010:07:28 15:40:33
[EXIF] Date/Time Original : 2010:07:28 15:40:33
[EXIF] Create Date : 2010:07:28 15:40:33
[Composite] Create Date : 2010:07:28 15:40:33.37
[Composite] Date/Time Original : 2010:07:28 15:40:33.37
[Composite] Modify Date : 2010:07:28 15:40:33.37
Martin
Quote from: gamin on November 30, 2010, 08:07:43 PM
I just tested 8.41 on about a dozen files, compared the dates after a negative shift of 5 seconds, and it seems to work properly.
Excellent. Thanks for testing this.
Quote
My Canon XSi does seem to generate fractional time, but not in a native tag, only in a composite, if that's what you mean by "do not support fractional seconds in the time string".
Yes. The Composite date/time tags are not writable so they are not affected by this bug.
- Phil