Skip to content

struct Athena::Clock::Native
inherits Struct #

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

Included modules

Athena::Clock::Interface

Constructors#

.new(location : Time::Location | Nil = nil)#

View source

Methods#

#in_location(location : Time::Location) : self#

Returns a new clock instance set to the provided location.

View source

#now : Time#

Returns the current time as determined by the clock.

View source

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

Sleeps for the provided span of time.

View source

#sleep(seconds : Number) : Nil#

Sleeps for the provided amount of seconds.

View source