summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-14 00:33:29 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-14 00:33:29 +0000
commit6a651b6cde7be734927ac787cede369b85dd18f4 (patch)
tree524d1c103930e591042d925bb661e50f066928e5 /lib
parent0d7451ba821b52a51fb6d2cd99cd916225fe4fb5 (diff)
* lib/time.rb: do not reference Time directly from the inside of
definitions. [ruby-dev:33059] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/time.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/time.rb b/lib/time.rb
index dbc25f4193..2de21cd7c8 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -66,7 +66,7 @@ class Time
'N' => -1, 'O' => -2, 'P' => -3, 'Q' => -4, 'R' => -5, 'S' => -6,
'T' => -7, 'U' => -8, 'V' => -9, 'W' => -10, 'X' => -11, 'Y' => -12,
}
- def zone_offset(zone, year=Time.now.year)
+ def zone_offset(zone, year=self.now.year)
off = nil
zone = zone.upcase
if /\A([+-])(\d\d):?(\d\d)\z/ =~ zone
@@ -75,9 +75,9 @@ class Time
off = zone.to_i * 3600
elsif ZoneOffset.include?(zone)
off = ZoneOffset[zone] * 3600
- elsif ((t = Time.local(year, 1, 1)).zone.upcase == zone rescue false)
+ elsif ((t = self.local(year, 1, 1)).zone.upcase == zone rescue false)
off = t.utc_offset
- elsif ((t = Time.local(year, 7, 1)).zone.upcase == zone rescue false)
+ elsif ((t = self.local(year, 7, 1)).zone.upcase == zone rescue false)
off = t.utc_offset
end
off
@@ -177,7 +177,7 @@ class Time
if off
year, mon, day, hour, min, sec =
apply_offset(year, mon, day, hour, min, sec, off)
- t = Time.utc(year, mon, day, hour, min, sec, usec)
+ t = self.utc(year, mon, day, hour, min, sec, usec)
t.localtime if !zone_utc?(zone)
t
else
@@ -236,7 +236,7 @@ class Time
#
# A failure for Time.parse should be checked, though.
#
- def parse(date, now=Time.now)
+ def parse(date, now=self.now)
d = Date._parse(date, false)
year = d[:year]
year = yield(year) if year && block_given?
@@ -368,9 +368,9 @@ class Time
zone = $8
year, mon, day, hour, min, sec =
apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
- Time.utc(year, mon, day, hour, min, sec, usec)
+ self.utc(year, mon, day, hour, min, sec, usec)
else
- Time.local(year, mon, day, hour, min, sec, usec)
+ self.local(year, mon, day, hour, min, sec, usec)
end
else
raise ArgumentError.new("invalid date: #{date.inspect}")