diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-02-18 07:50:36 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-18 08:46:22 -0800 |
commit | 28454889d9b63256300be7053ecd571084af356c (patch) | |
tree | ec3f45903a5e96868c69e3467cdadc53c4350393 /qt-ui/simplewidgets.cpp | |
parent | 1328b44d44e5efc2d811bd857c59314511e2e34b (diff) | |
download | subsurface-28454889d9b63256300be7053ecd571084af356c.tar.gz |
Use DateTimeOriginal on image import
Some digital cameras do not set the DateTime exif field bat use
DateTimeOriginal. If the first option is not found, use the second one
to try to detect the moment when the image was shot.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 1e189c1b8..4ee3998b9 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -209,7 +209,10 @@ time_t ShiftImageTimesDialog::epochFromExiv(EXIFInfo *exif) struct tm tm; int year, month, day, hour, min, sec; - sscanf(exif->DateTime.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec); + if (strlen(exif->DateTime.c_str())) + sscanf(exif->DateTime.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec); + else + sscanf(exif->DateTimeOriginal.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec); tm.tm_year = year; tm.tm_mon = month - 1; tm.tm_mday = day; |