diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-02-13 16:43:55 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-17 10:59:30 -0800 |
commit | bbb071f1e8e9429ea49d869437a56d2876fb8287 (patch) | |
tree | c8a761f7106ca047d59cee61af92071e61355a33 /qt-ui/divelistview.cpp | |
parent | fe2a264db3ee9ef49c87e5530d8d198357cd43b5 (diff) | |
download | subsurface-bbb071f1e8e9429ea49d869437a56d2876fb8287.tar.gz |
Compute dive computer/camera time offset from sample picture
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 14a2f30e5..c8a5f2b72 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -804,6 +804,7 @@ void DiveListView::loadImages() { struct memblock mem; EXIFInfo exif; + int retval; time_t imagetime; QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open Image Files"), lastUsedImageDir(), tr("Image Files (*.jpg *.jpeg *.pnm *.tif *.tiff)")); @@ -818,23 +819,16 @@ void DiveListView::loadImages() updateLastImageTimeOffset(shiftDialog.amount()); for (int i = 0; i < fileNames.size(); ++i) { - struct tm tm; - int year, month, day, hour, min, sec; - int retval; if (readfile(fileNames.at(i).toUtf8().data(), &mem) <= 0) continue; retval = exif.parseFrom((const unsigned char *) mem.buffer, (unsigned) mem.size); free(mem.buffer); if (retval != PARSE_EXIF_SUCCESS) continue; - sscanf(exif.DateTime.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; - tm.tm_hour = hour; - tm.tm_min = min; - tm.tm_sec = sec; - imagetime = utc_mktime(&tm) + shiftDialog.amount(); + imagetime = shiftDialog.epochFromExiv(&exif); + if (!imagetime) + continue; + imagetime += shiftDialog.amount(); int j = 0; struct dive *dive; for_each_dive(j, dive){ |