Skip to content

Instantly share code, notes, and snippets.

@agatan
Created December 17, 2017 09:30
Show Gist options
  • Save agatan/80c7643762b9a39c673b57ca6f6f10f5 to your computer and use it in GitHub Desktop.
Save agatan/80c7643762b9a39c673b57ca6f6f10f5 to your computer and use it in GitHub Desktop.
Example of timejump
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