struct

Athena::Clock::Native

Inherits Athena::Clock::Interface < Struct < Value < Object

The default clock for most use cases which returns the current system time. For example:

class ExpirationChecker
  def initialize(@clock : Athena::Clock::Interface); end

  def expired?(valid_until : Time) : Bool
    @clock.now > valid_until
  end
end

Constructors

new(location : Time::Location | Nil = nil)
Source

Instance methods

in_location(location : Time::Location) : self

Returns a new clock instance set to the provided location.

Source
now

Returns the current time as determined by the clock.

Source
sleep(span : Time::Span) : Nil

Sleeps for the provided span of time.

Source