class Athena::Clock

Overview

Decouples applications from the system clock.

Included Modules

Defined in:

athena-clock.cr
aware.cr

Constant Summary

VERSION = "0.1.2"

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Athena::Clock::Interface

in_location(location : Time::Location) : self in_location, now : Time now, sleep(span : Time::Span) : Nil
sleep(seconds : Number) : Nil
sleep

Constructor Detail

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

[View source]

Class Method Detail

def self.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]
def self.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]

Instance Method Detail

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

Returns a new clock instance set to the provided location.


[View source]
def now : Time #

Returns the current time as determined by the clock.


[View source]
def sleep(span : Time::Span) : Nil #

Sleeps for the provided span of time.


[View source]
def sleep(seconds : Number) : Nil #

Sleeps for the provided amount of seconds.


[View source]