Documentation ¶
Index ¶
Constants ¶
Approximate time units.
Variables ¶
This section is empty.
Functions ¶
func ReadTime ¶
ReadTime runs the function and returns the time if f is not null, or returns time.Now() if f is null.
func TimeDuration ¶
TimeDuration converts d to time.Duration. If d is nil, 0 duration is returned.
Types ¶
type Challenge ¶
Challenge is a timestamp with a crypto random nonce. A server can provide an HMAC signed challenge for clients via RPC, and use it as a structure to restrict the client into a time window that is defined by the server. It also provides a reliable clock source and a nonce source. The nonce can be used as a one-time token to defend replay attacks.
type Duration ¶
Duration is a struct to record a duration. It is designed to be directly usable in Javascript.
func NewDuration ¶
NewDuration creates a new duration of d.
type Timestamp ¶
Timestamp is a struct to record a UTC timestamp. It is designed to be directly usable in Javascript.
func NewTimestamp ¶
NewTimestamp creates a new timestamp from the given time.
func ReadTimestamp ¶
ReadTimestamp runs the function and returns the time as a Timestamp, or return the result of time.Now() as a timestamp.
func TimestampNow ¶
func TimestampNow() *Timestamp
TimestampNow creates a time stamp of the time now.