Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLocalTimeZone ¶
func SetLocalTimeZone(fitFile *fit.File) error
SetLocalTimeZone use the external library github.com/bradfitz/latlong and available FIT file GPS data (Record, Session or Lap messages) to set the timezone of local timestamps. It processes FIT files of type "Activity" and "ActivitySummary". It currently only attempts to set the local time zone of the field "LocalTimestamp" for the file's "Activity" message. SetLocalTimeZone returns a nil error if a local time zone was set or a descriptive error otherwise.
Example ¶
testFile := filepath.Join("../testdata", "fitsdk", "Activity.fit") testData, err := ioutil.ReadFile(testFile) if err != nil { fmt.Println(err) return } fit, err := fit.Decode(bytes.NewReader(testData)) if err != nil { fmt.Println(err) return } activity, err := fit.Activity() if err != nil { fmt.Println(err) return } fmt.Println("Post decode & pre SetLocalTimezone:") fmt.Println(activity.Activity.LocalTimestamp) err = timeutil.SetLocalTimeZone(fit) if err != nil { fmt.Println(err) return } fmt.Println("Post SetLocalTimezone:") fmt.Println(activity.Activity.LocalTimestamp)
Output: Post decode & pre SetLocalTimezone: 2012-04-09 17:24:51 -0400 FITLOCAL Post SetLocalTimezone: 2012-04-09 17:24:51 -0400 EDT
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.