Skip to content

Instantly share code, notes, and snippets.

@yanshiyason
Created February 16, 2019 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanshiyason/f59a5c9a449c681063f54d99fa771189 to your computer and use it in GitHub Desktop.
Save yanshiyason/f59a5c9a449c681063f54d99fa771189 to your computer and use it in GitHub Desktop.
func laterInTime(days time.Duration, do func()) {
resetTime := func() {
jwt.TimeFunc = func() time.Time {
return time.Now()
}
}
defer resetTime()
jwt.TimeFunc = func() time.Time {
return time.Now().Add(time.Hour * 24 * days)
}
do()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment