struct Athena::Clock::Native
- Athena::Clock::Native
- Struct
- Value
- Object
Overview
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
Defined in:
native.crConstructors
Instance Method Summary
-
#in_location(location : Time::Location) : self
Returns a new clock instance set to the provided location.
-
#now : Time
Returns the current time as determined by the clock.
-
#sleep(span : Time::Span) : Nil
Sleeps for the provided span of time.
-
#sleep(seconds : Number) : Nil
Sleeps for the provided amount of seconds.
Instance methods inherited from module Athena::Clock::Interface
in_location(location : Time::Location) : self
in_location,
now : Time
now,
sleep(span : Time::Span) : Nilsleep(seconds : Number) : Nil sleep
Constructor Detail
Instance Method Detail
def in_location(location : Time::Location) : self
#
Returns a new clock instance set to the provided location.