Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustSync ¶ added in v0.2.0
func MustSync()
MustSync is like Sync but panics if the internet is offline.
func Now ¶
Now returns the current remote time. If the remote time cannot be retrieved then the zero value for Time is returned. It's a good idea to test for zero after every call, such as:
now := rtime.Now() if now.IsZero() { ... handle failure ... }
func Sync ¶ added in v0.2.0
func Sync() error
Sync tells the application to keep rtime in sync with internet time. This ensures that all following rtime.Now() calls are fast, accurate, and without the need to check the result.
Ideally you would call this at the top of your main() or init() function.
if err := rtime.Sync(); err != nil { ... internet offline, handle error or try again ... return } rtime.Now() // guaranteed to be a valid time
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.