Skip to content

Instantly share code, notes, and snippets.

@zhangyoufu
Last active May 23, 2019 09:56
Show Gist options
  • Save zhangyoufu/7c7404668419a2fedbf25aefb68c9ea9 to your computer and use it in GitHub Desktop.
Save zhangyoufu/7c7404668419a2fedbf25aefb68c9ea9 to your computer and use it in GitHub Desktop.
get real-world time in Go playground
package main
import (
"fmt"
"time"
_ "unsafe"
)
//go:linkname faketime runtime.faketime
var faketime int64
func main() {
fmt.Println(faketime)
fmt.Println(time.Now())
faketime = 0
fmt.Println(faketime)
fmt.Println(time.Now())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment