Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpx timestamp #686

Open
flock-vi opened this issue Sep 8, 2024 · 2 comments
Open

gpx timestamp #686

flock-vi opened this issue Sep 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@flock-vi
Copy link

flock-vi commented Sep 8, 2024

Describe the bug

Gpx-File: Trackpoints with timestamps with less than 3 digits after the decimalpoint give an error, when the first of those digits is 0

What have you done to circle down the problem?

Different timestamps but I only tried it with Version 1.17.1

To Reproduce

Import "Test.gpx"
Have a look at the trackpoints
less than 3 digits, first one not equal 0: ok
less than 3 digits, first one equal 0: "Ungültige Zeitmarken!"

Expected behavior

might work with each timestamp

Screenshots

grafik

Attachments

Test_gpx.txt

Tracebacks

Desktop

  • OS: Windows 10
  • QMapShack Version: QMS 1.17.1
  • Window Manager: [e.g. KDE, GNOME]

Additional context

@flock-vi flock-vi added the bug Something isn't working label Sep 8, 2024
@kiozen
Copy link
Collaborator

kiozen commented Sep 9, 2024

This is less a bug in QMapShack more one in the originating app. There is a certain understanding on how to code milliseconds in time stamps. See https://qthub.com/static/doc/qt5/qtcore/qtime.html#toString

Also have a look at the code:

QDateTime IUnit::parseTimestamp(const QString& timetext, int& tzoffset) {

If you think you can do better without breaking other formats feel free to provide a PR.

@kkarsten62
Copy link
Contributor

Maybe we can check against a regex to distinguish between z and zzz.

IMHO this seems not correct in this case
if (timetext[i + 1] == '0') {
But I can not oversee all the other cases where QDateTime IUnit::parseTimestamp is used and possible sideeffects!

With regex code could be:

    const QRegExp hasTrailingZeroRE(".*(\\.\\d*?[1-9])0+.*");
    if(hasTrailingZeroRE.exactMatch(timetext)) {
      format += ".zzz";
    } else {
      format += ".z";
    }
  }

I have checked regex with https://regex101.com/r/jgGc1C/2

.0 ==> z ==> valid in QMS
.00 ==> z ==> valid in QMS
.000 ==> z ==> valid in QMS
.1 ==> z ==> valid in QMS
.12 ==> z ==> valid in QMS
.123 ==> z ==> valid in QMS
.01 ==> z ==> valid in QMS
.001 ==> z ==> valid in QMS
.10 ==> zzz ==> invalid in QMS, 3 digits expected
.100 ==> zzz ==> valid in QMS
.120 ==> zzz ==> valid in QMS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants