Created
December 17, 2017 09:30
-
-
Save agatan/80c7643762b9a39c673b57ca6f6f10f5 to your computer and use it in GitHub Desktop.
Example of timejump
This file contains 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" | |
"github.com/agatan/timejump" | |
) | |
func F() { | |
now := timejump.Now() | |
fmt.Println("What year is this?") | |
fmt.Printf("It's %d.\n", now.Year()) | |
} | |
func ExampleF() { | |
timejump.Activate() | |
defer timejump.Deactivate() | |
timejump.Stop() | |
timejump.Jump(time.Date(1999, time.December, 17, 18, 31, 00, 00, time.UTC)) | |
F() | |
// Output: | |
// What year is this? | |
// It's 1999. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment