GPS time off by 1 minute error fix #886
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Discovered that sometimes, when a photo is taken near the end of a minute, the gps data will be added in the next full minute.
For example:
A foto taken at time
14:45:56+02:00
, if the GPS or something is slow, the GPS timestamp might be12:46:01Z
.In cases where GPS date is used to calculate creationTimeOffset, this causes some weird errors with invalid offsets, which led to exceptions in date parsing, ultimately resetting creationTime to 0 (1970).
Fixed this and discovered a bug with GPS time. Sometimes GPS time is stored in the GPS tags instead of the XMP:GPS tags and their format is different and hours and minutes need zeropadding. The code for the tags was already there, but the zero-padding was lacking for single digit hours, minutes and seconds.
After fixing these things, some tests showed that some expectation data was wrong (oops). Fixed those too.
Finally an edge case test suddenly began (correctly) to fall back to file modification timestamp as creationDate. However, those file timestamps are notorious for testing... because they are updated at each git clone. So had to fix another way to include such timestamps in tests.
This is added, currently in a not so generic way in the
MetadataLoader.spec.ts
. In the tests you can now writefileModificationTime
instead of a number, and it will cause a separate lookup (only during testing) of the filemodification time to compare with.Extra tests added to take care of the originally discovered bugs: