class
Time::Location
- Time::Location
- Reference
- Object
Overview
Location maps time instants to the zone in use at that time.
It typically represents the collection of time offsets observed in
a certain geographical area.
It contains a list of zone offsets and rules for transitioning between them.
If a location has only one offset (such as UTC) it is considered
fixed.
A Location instance is usually retrieved by name using
Time::Location.load.
It loads the zone offsets and transitioning rules from the time zone database
provided by the operating system.
location = Time::Location.load("Europe/Berlin")
location # => #<Time::Location Europe/Berlin>
time = Time.local(2016, 2, 15, 21, 1, 10, location: location)
time # => 2016-02-15 21:01:10 +01:00 Europe/Berlin
A custom time zone database can be configured through the environment variable
ZONEINFO. See .load for details.
Fixed Offset
A fixed offset location is created using Time::Location.fixed:
location = Time::Location.fixed(3600)
location # => #<Time::Location +01:00>
location.zones # => [#<Time::Location::Zone +01:00 (0s) STD>]
Local Time Zone
The local time zone can be accessed as Time::Location.local.
It is initially configured according to system environment settings, but its value can be changed:
location = Time::Location.local
Time::Location.local = Time::Location.load("America/New_York")
Defined in:
remilib/rsconf/torsconf.crConstructors
Instance Method Summary
Instance methods inherited from class Object
toRsconf(io : IO, *, indentSize : Int = 2, alwaysQuoteKeys : Bool = false, explicitRootObject : Bool = false, commaAfterValues : Bool = false, extraNewlineBetweenToplevelKeys : Bool = false) : NiltoRsconf(*, indentSize : Int = 2, alwaysQuoteKeys : Bool = false, explicitRootObject : Bool = false, commaAfterValues : Bool = false, extraNewlineBetweenToplevelKeys : Bool = false) : String toRsconf
Class methods inherited from class Object
fromRsconf(toplevel : RemiLib::RSConf::RSValue)fromRsconf(data : String | IO | Path) fromRsconf