Created
May 8, 2018 07:13
-
-
Save matejb/fa7195b5bf37014fe2a98f14d3aef7b6 to your computer and use it in GitHub Desktop.
Revisions
-
matejb created this gist
May 8, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // normalizeLocalTime will normalize local time expressed in number of seconds // from UNIX Epoch but not in UTC but counted in local location to the one // counted correctly from UTC location. func normalizeLocalTime(localNumOfSeconds int64, location *time.Location) time.Time { t := time.Unix(localNumOfSeconds, 0).In(location) _, offset := t.Zone() // we apply offset in reverse to correct time return t.Add(-1 * time.Duration(offset) * time.Second) }