Description
From @aral on July 4, 2018 16:26
I'm running Hugo on my Nexus 5 via Termux (thank you, by the way, for this amazing contribution to humanity) and when I changed the datestamp on a post manually to the current time, I noticed that Hugo did not build my post because it thought the time was in the future. That's when I realised that it had written the date stamp with a timezone of Z while creating the post instead of +01:00 (I'm on Irish Standard Time at the moment).
Context
- Time and timezone on the phone is set and displayed correctly
- In a Termux session,
dateproduces the right time and date and timezone (IST) - getprop persist.sys.timezone produces the correct timezone (Europe/Dublin)
To replicate
The following basic Go app produces the wrong timezone consistently for me both under plain Termux and under termux-chroot:
package main
import "time"
import "fmt"
func main() {
p := fmt.Println
t := time.Now()
p(t.Format(time.RFC3339))
}
Sample output
date
Wed Jul 4 16:48:28 IST 2018
getprop persist.sys.timezone
Europe/Dublin
go run time.go
2018-07-04T15:48:37Z
So Go thinks its on UTC even though we're on IST.
Update
I’ve just verified on my Mac that this is erroneous behaviour in Termux and not an anomaly specific to Go. The output of the same script and the corresponding date results are in the screenshot below:
Update 2
As a further check, the issue does not exist in Node.js under a Termux session. The following code:
let t = new Date().toTimeString()
console.log(t)
Produces:
17:38:36 GMT +0100 (IST)
Copied from original issue: termux/termux-app#760