Skip to content

class Athena::Clock
inherits Reference #

Decouples applications from the system clock.

Included modules

Athena::Clock::Interface

Constants#

VERSION = "0.1.2"#

Constructors#

.new(clock : ACLK::Interface | Nil = nil, location : Time::Location | Nil = nil)#

View source

Class methods#

.clock : ACLK::Interface#

Represents the global clock used by all Athena::Clock instances.

Note

It is preferable injecting an Athena::Clock::Interface when possible versus using the global clock getter.

View source

.clock=(clock : ACLK::Interface)#

Represents the global clock used by all Athena::Clock instances.

Note

It is preferable injecting an Athena::Clock::Interface when possible versus using the global clock getter.

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