Skip to content

Conversation

@grasdk
Copy link
Contributor

@grasdk grasdk commented Apr 13, 2024

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 be 12: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 write fileModificationTime 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:

  • GPS timestamp off by 1 minute
  • GPS timestamp off by 1 minute AND GPS data in the GPS-section missed some zero-padding.

@bpatrik bpatrik merged commit c65868e into bpatrik:master Apr 14, 2024
@grasdk grasdk deleted the bug/gpstime_off_by_1_min branch April 21, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants