Last active
May 23, 2019 09:56
-
-
Save zhangyoufu/7c7404668419a2fedbf25aefb68c9ea9 to your computer and use it in GitHub Desktop.
get real-world time in Go playground
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 characters
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