File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,12 @@ def ==(other)
150150 `#{ to_f } === #{ other . to_f } `
151151 end
152152
153+ def asctime
154+ strftime '%a %b %e %H:%M:%S %Y'
155+ end
156+
157+ alias ctime asctime
158+
153159 def day
154160 `self.getDate()`
155161 end
@@ -236,6 +242,10 @@ def zone
236242 }
237243 end
238244
245+ def gmt?
246+ `self.tz_offset == 0`
247+ end
248+
239249 def gmt_offset
240250 `-self.getTimezoneOffset() * 60`
241251 end
@@ -494,9 +504,7 @@ def tuesday?
494504 `self.getDay() === 2`
495505 end
496506
497- def utc?
498- `self.tz_offset == 0`
499- end
507+ alias utc? gmt?
500508
501509 def utc_offset
502510 `self.getTimezoneOffset() * -60`
Original file line number Diff line number Diff line change 2323 fails "Time.gm creates a time based on given C-style gmtime arguments, interpreted as UTC (GMT)"
2424 fails "Time.gm creates a time based on given values, interpreted as UTC (GMT)"
2525
26+ fails "Time#gmt_offset given negative offset returns a negative offset"
27+ fails "Time#gmt_offset given positive offset returns a positive offset"
28+ fails "Time#gmt_offset returns offset as Rational"
29+ fails "Time#gmt_offset returns the correct offset for New Zealand around daylight savings time change"
30+ fails "Time#gmt_offset returns the correct offset for Hawaii around daylight savings time change"
31+ fails "Time#gmt_offset returns the correct offset for US Eastern time zone around daylight savings time change"
32+ fails "Time#gmt_offset returns the offset in seconds between the timezone of time and UTC"
33+
2634 fails "Time.local ignores fractional seconds if a passed fractional number of microseconds"
2735 fails "Time.local ignores fractional seconds if a passed whole number of microseconds"
2836 fails "Time.local handles fractional microseconds as a Rational"
Original file line number Diff line number Diff line change @@ -322,10 +322,13 @@ core/struct/new_spec
322322
323323core/class/new_spec
324324
325+ core/time/asctime_spec
326+ core/time/ctime_spec
325327core/time/day_spec
326328core/time/eql_spec
327329core/time/friday_spec
328330core/time/gm_spec
331+ core/time/gmt_offset_spec
329332core/time/hour_spec
330333core/time/inspect_spec
331334core/time/local_spec
You can’t perform that action at this time.
0 commit comments