class

Ruby::V4::Time

Inherits Comparable < Reference < Object

Constants

DAY_L = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
DAY_S = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
MON_L = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
MON_S = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

Constructors

at(seconds : Int, frac : Int, unit : Symbol = :usec) : self

Time.at(sec, frac, unit): :millisecond / :usec / :nanosecond.

Source
at(seconds : Int) : self

Time.at — локальное время (как в Ruby): Time.at(0).to_s в MSK даёт "1970-01-01 03:00:00 +0300".

Source
at(seconds : Float) : self
Source
gm(*args) : self
Source
local(year : Int, mon = 1, day = 1, hour = 0, min = 0, sec = 0, usec = 0) : self
Source
mktime(*args) : self
Source
new(t : ::Time, zone : String | Nil = nil, subsec : Rational = Rational.new(0_i64, 1_i64))
Source
new(year : Int, mon = 1, day = 1, hour = 0, min = 0, sec = 0, zone : String | Int | Nil = nil) : self

Time.new(...) — сейчас; Time.new(y, m, d, h, min, s, zone); zone: строка "+05:30"/"-03:00"/"UTC", либо Int-офсет в секундах.

Source
parse(str : String) : self
Source
strptime(str : String, fmt : String) : self

strptime: %Y %m %d %y %H %M %S (жадно, без ведущего нуля — как Date._strptime: %H читает и "7", и "07") + буквальные символы. Результат — локальное время.

Source
utc(year : Int, mon = 1, day = 1, hour = 0, min = 0, sec = 0, usec = 0) : self
Source

Class methods

zone_offset(str : String) : Int32
Source

Instance methods

+(seconds : Int) : self
Source
+(seconds : Float) : self
Source
-(seconds : Int) : self
Source
-(other : self) : Float64
Source
<=>(other : self) : Int32
Source
==(other : self) : Bool

Returns true if this reference is the same as other. Invokes same?.

Source
ceil(digits : Int = 0) : self
Source
dst?
Source
friday?
Source
getlocal
Source
getutc
Source
hour
Source
httpdate
Source
inspect

inspect показывает дробную часть ("03:00:01.5 +0300"), to_s — нет.

Source
iso8601(fraction_digits = 0) : String
Source
localtime
Source
mday
Source
monday?
Source
month
Source
nsec
Source
offset_str(colons : Int32 = 0) : String
Source
rfc2822
Source
round(digits : Int = 0) : self

round/ceil с точностью digits знаков субсекунды, half-up с переносом в секунду (Ruby: Time#round(3) у 0.999999999 → 1.000000000).

Source
saturday?
Source
strftime(fmt : String) : String
Source
subsec

Точная дробная часть как Rational: Time.at(0.5).subsec → (1/2).

Source
sunday?
Source
thursday?
Source
to_a
Source
to_date
Source
to_datetime
Source
to_f
Source
to_i
Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
tuesday?
Source
usec
Source
utc?
Source
utc_offset
Source
wday
Source
wednesday?
Source
xmlschema(fraction_digits = 0) : String
Source
yday
Source
year
Source
zone
Source