Changeset 9499 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-01-17T13:10:38+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ExifReader.java
r9383 r9499 42 42 Metadata metadata = JpegMetadataReader.readMetadata(filename); 43 43 String dateStr = null; 44 OUTER:44 String subSeconds = null; 45 45 for (Directory dirIt : metadata.getDirectories()) { 46 46 for (Tag tag : dirIt.getTags()) { … … 48 48 !tag.getDescription().matches("\\[[0-9]+ .+\\]")) { 49 49 dateStr = tag.getDescription(); 50 break OUTER; // prefer this tag if known51 50 } 52 51 if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */ || 53 52 tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) { 54 dateStr = tag.getDescription(); 53 if (dateStr != null) { 54 // prefer TAG_DATETIME_ORIGINAL 55 dateStr = tag.getDescription(); 56 } 57 } 58 if (tag.getTagType() == ExifIFD0Directory.TAG_SUBSECOND_TIME_ORIGINAL) { 59 subSeconds = tag.getDescription(); 55 60 } 56 61 } … … 58 63 if (dateStr != null) { 59 64 dateStr = dateStr.replace('/', ':'); // workaround for HTC Sensation bug, see #7228 60 return DateUtils.fromString(dateStr); 65 final Date date = DateUtils.fromString(dateStr); 66 if (subSeconds != null) { 67 try { 68 date.setTime(date.getTime() + Integer.parseInt(subSeconds)); 69 } catch (NumberFormatException e) { 70 Main.warn("Failed parsing sub seconds from [{0}]", subSeconds); 71 Main.warn(e); 72 } 73 } 74 return date; 61 75 } 62 76 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.