gpxgo
gpxgo copied to clipboard
About ToXml formatGPXTime
xml.go formatGPXTime method
const formattingTimelayout = "2006-01-02T15:04:05Z"
func formatGPXTime(time *time.Time) string {
if time == nil {
return ""
}
if time.Year() <= 1 {
// Invalid date:
return ""
}
return time.Format(formattingTimelayout)
}
maybe, use 2006-01-02T15:04:05.000Z not 2006-01-02T15:04:05Z
When I used the gpx file and tried to modify the speed to 100km/h, I encountered the problem of losing time accuracy.
eg : https://gpx.studio/ , This website can customize the speed .
Yes, good point.
Maybe something like this: https://github.com/tkrajina/gpxgo/commit/0a078e11c1cccf5466ffb087efcecff0246235c0#diff-467db995cc9329f7c2de3abceee7282826fdedf16a6c4efee5b2f3370065f8bdR145 (It will use the format with ms only if milliseconds are actually != 0).