diff options
| author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-12 03:03:31 +0000 |
|---|---|---|
| committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-12 03:03:31 +0000 |
| commit | 5744c8d719b8f2d304e2fc45f61aa8249a02206d (patch) | |
| tree | 717a67ad5982a426b8b10eab3ece81d2f0f26932 /lib/date | |
| parent | bab6f70c551aa5f4c7147d8fc9ebd8db9d21cb9a (diff) | |
| download | ruby-5744c8d719b8f2d304e2fc45f61aa8249a02206d.tar.gz ruby-5744c8d719b8f2d304e2fc45f61aa8249a02206d.tar.xz ruby-5744c8d719b8f2d304e2fc45f61aa8249a02206d.zip | |
* lib/date.rb, lib/date/format.rb: tuning for performance.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/date')
| -rw-r--r-- | lib/date/format.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/date/format.rb b/lib/date/format.rb index 8e47eda59..67d58d465 100644 --- a/lib/date/format.rb +++ b/lib/date/format.rb @@ -1,5 +1,5 @@ # format.rb: Written by Tadayoshi Funaba 1999-2008 -# $Id: format.rb,v 2.41 2008-01-06 08:42:17+09 tadf Exp $ +# $Id: format.rb,v 2.42 2008-01-12 10:54:29+09 tadf Exp $ require 'rational' @@ -297,9 +297,9 @@ class Date t = $1.size sign = if offset < 0 then -1 else +1 end fr = offset.abs - hh, fr = fr.divmod(HOURS_IN_DAY) - mm, fr = fr.divmod(MINUTES_IN_DAY) - ss, fr = fr.divmod(SECONDS_IN_DAY) + ss = fr.div(SECONDS_IN_DAY) # 4p + hh, ss = ss.divmod(3600) + mm, ss = ss.divmod(60) if t == 3 if ss.nonzero? then t = 2 elsif mm.nonzero? then t = 1 |
