Bug #732
Setting the file timestamp from EXIF data fails by 1 hour
100%
Description
The following illustrates the problem:
$ exiv2 dsd_2180.jpg | grep timestamp
Image timestamp : 2010:08:23 18:39:56
$ exiv2 mv T dsd_2180.jpg 1 ariel users 2332635 Aug 23 19:39 dsd_2180.jpg
$ l dsd_2180.jpg
-r-------
$ exiv2 dsd_2180.jpg | grep timestamp
Image timestamp : 2010:08:23 18:39:56
Note the 1 hour shift between the file timestamp set (19:39) and the photo
timestamp in EXIF (18:36)!!
This has previously worked flawlessly.
System date is fine and updated with ntpdate.
$ cat /etc/timezone
Europe/Berlin
is also fine.
Files
History
Updated by Ariel Garcia about 11 years ago
Versions:
exiv2 0.20-2
libexiv2-9 0.20-2
Debian testing packages, amd64
Updated by Andreas Huggel about 11 years ago
Can you please provide the output of exiv2 -pa for such an image - I'd like to see all the timestamps. Or even better, provide an image to test with.
Updated by Ariel Garcia about 11 years ago
- File DSD_1695.JPG DSD_1695.JPG added
- File exiv-out-DSD_1695.txt exiv-out-DSD_1695.txt added
Sure, attached a photo and the exiv2 -pa output.
I guess the problem is the
Exif.NikonWt.Timezone = UTC +01:00
field, when actually it was UTC+01:00/daylight-saving time (ie, +2).
However, running
exiv2 mv -T *.jpg
has previously always worked flawlessly for me, same camera, same settings.
Could it be that the way of handling the summertime changed?
Thanks!!
Updated by Ariel Garcia over 6 years ago
Well, it has been some time now... but this issue seems to have been fixed meanwhile :)
Using Exiv 0.24-4 from Debian...
Updated by Robin Mills over 6 years ago
- Status changed from New to Assigned
- Assignee set to Robin Mills
- Target version set to 0.25
Gosh, this is an old issue. I was unaware that this was outstanding. I'll look at this later today.
Updated by Robin Mills over 6 years ago
I'm going to leave this "Assigned" for a little while. To my knowledge, Exiv2 has no code TZ knowledge and relies on the host OS.
I've been using exiv2 -T to update my files for years while living in California. I've never noticed anything unusual about the dates on the file system - even with a Canon camera which was TimeZone/DST aware.
I now live in England and have an Nikon 5300 which is not only TZ/DST aware, it also has a GPS (and an option to set his clock using the GPS). DST starts here on March 29. If that transition is OK, I'll mark this as "Resolved".
I have run some tests, which have left me uncertain, and that's why I've decided to "wait and see in April in England"!
$ # Download fresh copy of test file $ curl -O http://dev.exiv2.org/attachments/download/206/DSD_1695.JPG % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2274k 0 2274k 0 0 2018k 0 --:--:-- 0:00:01 --:--:-- 2018k $ Get the Metadata $ exiv2 -g Date -g Time -g Zone DSD_1695.JPG Exif.Image.DateTime Ascii 20 2010:07:18 19:23:30 Exif.Photo.ExposureTime Rational 1 1/200 s Exif.Photo.DateTimeOriginal Ascii 20 2010:07:18 19:23:30 Exif.Photo.DateTimeDigitized Ascii 20 2010:07:18 19:23:30 Exif.NikonWt.Timezone SShort 1 UTC +01:00 Exif.NikonWt.DateDisplayFormat Byte 1 D/M/Y Exif.Photo.SubSecTime Ascii 3 48 Exif.Photo.SubSecTimeOriginal Ascii 3 48 Exif.Photo.SubSecTimeDigitized Ascii 3 48 $ # File system thinks $ stat DSD_1695.JPG 16777220 50259960 -rw-r--r-- 1 rmills staff 0 2329314 "Mar 12 16:06:16 2015" "Mar 12 16:07:17 2015" "Mar 12 16:07:17 2015" "Mar 12 16:06:14 2015" 4096 4552 0 DSD_1695.JPG 580 $ # Update the stamps 581 $ exiv2 -T DSD_1695.JPG 582 $ stat DSD_1695.JPG 16777220 50259960 -rw-r--r-- 1 rmills staff 0 2329314 "Jul 18 19:23:30 2010" "Jul 18 19:23:30 2010" "Mar 12 16:09:12 2015" "Jul 18 19:23:30 2010" 4096 4552 0 DSD_1695.JPG 583 $ # switch to PDT (-7:00) 584 $ date Thu 12 Mar 2015 09:09:54 PDT $ # Download fresh copy of test file $ curl -O http://dev.exiv2.org/attachments/download/206/DSD_1695.JPG % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2274k 0 2274k 0 0 2225k 0 --:--:-- 0:00:01 --:--:-- 2225k $ stat DSD_1695.JPG 16777220 50259960 -rw-r--r-- 1 rmills staff 0 2329314 "Jul 18 11:23:30 2010" "Mar 12 09:10:11 2015" "Mar 12 09:10:11 2015" "Jul 18 11:23:30 2010" 4096 4552 0 DSD_1695.JPG $ # Update the stamps $ exiv2 -T DSD_1695.JPG $ stat DSD_1695.JPG 16777220 50259960 -rw-r--r-- 1 rmills staff 0 2329314 "Jul 18 19:23:30 2010" "Jul 18 19:23:30 2010" "Mar 12 09:10:35 2015" "Jul 18 11:23:30 2010" 4096 4552 0 DSD_1695.JPG $
Updated by Robin Mills over 6 years ago
- Status changed from Assigned to Resolved
I'm going to mark this "Resolved" as I don't believe there is a case to answer. I photos in the beautiful city of Oxford this evening and post-processed them when I got home. Here's what I see:
509 rmills@rmillsmbp:~/Pictures/2015/Oxford $ exiv2 -pa DSC_6440.jpg | grep -e 2015 -i -e gps Exif.Image.DateTime Ascii 20 2015:04:06 22:47:17 Exif.Photo.DateTimeOriginal Ascii 20 2015:04:06 18:46:34 Exif.Photo.DateTimeDigitized Ascii 20 2015:04:06 18:46:34 Xmp.xmp.ModifyDate XmpText 25 2015-04-06T22:47:17+01:00 510 rmills@rmillsmbp:~/Pictures/2015/Oxford $ ls -alt DSC_6440.jpg -rw-r--r--+ 1 rmills staff 6841271 6 Apr 22:47 DSC_6440.jpg 511 rmills@rmillsmbp:~/Pictures/2015/Oxford $ exiv2 -T DSC_6440.jpg 512 rmills@rmillsmbp:~/Pictures/2015/Oxford $ ls -alt DSC_6440.jpg -rw-r--r--+ 1 rmills staff 6841271 6 Apr 18:46 DSC_6440.jpg 513 rmills@rmillsmbp:~/Pictures/2015/Oxford $ date Mon 6 Apr 2015 23:12:34 BST 514 rmills@rmillsmbp:~/Pictures/2015/Oxford $Everything looks fine to me. The photo was taken at 18:46 and updated at 22:47. exiv2 -T restored the time stamp.
514 rmills@rmillsmbp:~/Pictures/2015/Oxford $ # ----- change to San Jose, CA ------------ 515 rmills@rmillsmbp:~/Pictures/2015/Oxford $ date Mon 6 Apr 2015 15:16:02 PDT 516 rmills@rmillsmbp:~/Pictures/2015/Oxford $ exiv2 -T DSC_6440.jpg 517 rmills@rmillsmbp:~/Pictures/2015/Oxford $ ls -alt DSC_6440.jpg -rw-r--r--+ 1 rmills staff 6841271 6 Apr 2015 DSC_6440.jpg 518 rmills@rmillsmbp:~/Pictures/2015/Oxford $ stat DSC_6440.jpg 16777220 51470423 -rw-r--r-- 1 rmills staff 0 6841271 \ ... "Apr 6 15:16:26 2015" "Apr 6 18:46:34 2015" \ ... "Apr 6 15:16:20 2015" "Apr 6 10:46:34 2015" 4096 13368 0 DSC_6440.jpg 519 rmills@rmillsmbp:~/Pictures/2015/Oxford $Curiously, ls -alt does not report the date correctly. How odd. However stat appears to be less nervous. Reset the machine's date/time prefs, exiv2 -T is effective in restoring the date.
519 rmills@rmillsmbp:~/Pictures/2015/Oxford $ # ------ change to BST (+00:00 + DayLightSaving) 520 rmills@rmillsmbp:~/Pictures/2015/Oxford $ ls -alt DSC_6440.jpg -rw-r--r--+ 1 rmills staff 6841271 7 Apr 2015 DSC_6440.jpg 521 rmills@rmillsmbp:~/Pictures/2015/Oxford $ exiv2 -T DSC_6440.jpg 522 rmills@rmillsmbp:~/Pictures/2015/Oxford $ ls -alt DSC_6440.jpg -rw-r--r--+ 1 rmills staff 6841271 6 Apr 18:46 DSC_6440.jpg 523 rmills@rmillsmbp:~/Pictures/2015/Oxford $