gpxgo icon indicating copy to clipboard operation
gpxgo copied to clipboard

About ToXml formatGPXTime

Open yangyang5214 opened this issue 1 year ago • 1 comments

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 .

yangyang5214 avatar Apr 24 '24 09:04 yangyang5214

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).

tkrajina avatar May 19 '24 18:05 tkrajina