[前][次][番号順一覧][スレッド一覧]

ruby-changes:66100

From: Nobuyoshi <ko1@a...>
Date: Sat, 8 May 2021 11:47:13 +0900 (JST)
Subject: [ruby-changes:66100] 30d2d72663 (master): Shrink timev.rb iseq size

https://git.ruby-lang.org/ruby.git/commit/?id=30d2d72663

From 30d2d72663adfbce80ee122a2f6763eff6a7674e Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 8 May 2021 11:40:20 +0900
Subject: Shrink timev.rb iseq size

---
 timev.rb | 116 +++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/timev.rb b/timev.rb
index 1c29b66..07dd208 100644
--- a/timev.rb
+++ b/timev.rb
@@ -1,63 +1,63 @@ https://github.com/ruby/ruby/blob/trunk/timev.rb#L1
-# Creates a new \Time object from the current system time.
-# This is the same as Time.new without arguments.
-#
-#    Time.now               # => 2009-06-24 12:39:54 +0900
-#    Time.now(in: '+04:00') # => 2021-04-30 01:56:44 +0400
-#
-# Parameter:
-# :include: doc/time/in.rdoc
-def Time.now(in: nil)
-  new(in: __builtin.arg!(:in))
-end
+class Time
+  # Creates a new \Time object from the current system time.
+  # This is the same as Time.new without arguments.
+  #
+  #    Time.now               # => 2009-06-24 12:39:54 +0900
+  #    Time.now(in: '+04:00') # => 2021-04-30 01:56:44 +0400
+  #
+  # Parameter:
+  # :include: doc/time/in.rdoc
+  def self.now(in: nil)
+    new(in: __builtin.arg!(:in))
+  end
 
-# _Time_
-#
-# This form accepts a \Time object +time+
-# and optional keyword argument +in+:
-#
-#   Time.at(Time.new)               # => 2021-04-26 08:52:31.6023486 -0500
-#   Time.at(Time.new, in: '+09:00') # => 2021-04-26 22:52:32.1480341 +0900
-#
-# _Seconds_
-#
-# This form accepts a numeric number of seconds +sec+
-# and optional keyword argument +in+:
-#
-#   Time.at(946702800)               # => 1999-12-31 23:00:00 -0600
-#   Time.at(946702800, in: '+09:00') # => 2000-01-01 14:00:00 +0900
-#
-# <em>Seconds with Subseconds and Units</em>
-#
-# This form accepts an integer number of seconds +sec_i+,
-# a numeric number of milliseconds +msec+,
-# a symbol argument for the subsecond unit type (defaulting to :usec),
-# and an optional keyword argument +in+:
-#
-#   Time.at(946702800, 500, :millisecond)               # => 1999-12-31 23:00:00.5 -0600
-#   Time.at(946702800, 500, :millisecond, in: '+09:00') # => 2000-01-01 14:00:00.5 +0900
-#   Time.at(946702800, 500000)                             # => 1999-12-31 23:00:00.5 -0600
-#   Time.at(946702800, 500000, :usec)                      # => 1999-12-31 23:00:00.5 -0600
-#   Time.at(946702800, 500000, :microsecond)               # => 1999-12-31 23:00:00.5 -0600
-#   Time.at(946702800, 500000, in: '+09:00')               # => 2000-01-01 14:00:00.5 +0900
-#   Time.at(946702800, 500000, :usec, in: '+09:00')        # => 2000-01-01 14:00:00.5 +0900
-#   Time.at(946702800, 500000, :microsecond, in: '+09:00') # => 2000-01-01 14:00:00.5 +0900
-#   Time.at(946702800, 500000000, :nsec)                     # => 1999-12-31 23:00:00.5 -0600
-#   Time.at(946702800, 500000000, :nanosecond)               # => 1999-12-31 23:00:00.5 -0600
-#   Time.at(946702800, 500000000, :nsec, in: '+09:00')       # => 2000-01-01 14:00:00.5 +0900
-#   Time.at(946702800, 500000000, :nanosecond, in: '+09:00') # => 2000-01-01 14:00:00.5 +0900
-#
-# Parameters:
-# :include: doc/time/sec_i.rdoc
-# :include: doc/time/msec.rdoc
-# :include: doc/time/usec.rdoc
-# :include: doc/time/nsec.rdoc
-# :include: doc/time/in.rdoc
-#
-def Time.at(time, subsec = (nosubsec = true), unit = (nounit = true), in: nil)
-  __builtin.time_s_at(time, subsec, unit, __builtin.arg!(:in), nosubsec, nounit)
-end
+  # _Time_
+  #
+  # This form accepts a \Time object +time+
+  # and optional keyword argument +in+:
+  #
+  #   Time.at(Time.new)               # => 2021-04-26 08:52:31.6023486 -0500
+  #   Time.at(Time.new, in: '+09:00') # => 2021-04-26 22:52:32.1480341 +0900
+  #
+  # _Seconds_
+  #
+  # This form accepts a numeric number of seconds +sec+
+  # and optional keyword argument +in+:
+  #
+  #   Time.at(946702800)               # => 1999-12-31 23:00:00 -0600
+  #   Time.at(946702800, in: '+09:00') # => 2000-01-01 14:00:00 +0900
+  #
+  # <em>Seconds with Subseconds and Units</em>
+  #
+  # This form accepts an integer number of seconds +sec_i+,
+  # a numeric number of milliseconds +msec+,
+  # a symbol argument for the subsecond unit type (defaulting to :usec),
+  # and an optional keyword argument +in+:
+  #
+  #   Time.at(946702800, 500, :millisecond)               # => 1999-12-31 23:00:00.5 -0600
+  #   Time.at(946702800, 500, :millisecond, in: '+09:00') # => 2000-01-01 14:00:00.5 +0900
+  #   Time.at(946702800, 500000)                             # => 1999-12-31 23:00:00.5 -0600
+  #   Time.at(946702800, 500000, :usec)                      # => 1999-12-31 23:00:00.5 -0600
+  #   Time.at(946702800, 500000, :microsecond)               # => 1999-12-31 23:00:00.5 -0600
+  #   Time.at(946702800, 500000, in: '+09:00')               # => 2000-01-01 14:00:00.5 +0900
+  #   Time.at(946702800, 500000, :usec, in: '+09:00')        # => 2000-01-01 14:00:00.5 +0900
+  #   Time.at(946702800, 500000, :microsecond, in: '+09:00') # => 2000-01-01 14:00:00.5 +0900
+  #   Time.at(946702800, 500000000, :nsec)                     # => 1999-12-31 23:00:00.5 -0600
+  #   Time.at(946702800, 500000000, :nanosecond)               # => 1999-12-31 23:00:00.5 -0600
+  #   Time.at(946702800, 500000000, :nsec, in: '+09:00')       # => 2000-01-01 14:00:00.5 +0900
+  #   Time.at(946702800, 500000000, :nanosecond, in: '+09:00') # => 2000-01-01 14:00:00.5 +0900
+  #
+  # Parameters:
+  # :include: doc/time/sec_i.rdoc
+  # :include: doc/time/msec.rdoc
+  # :include: doc/time/usec.rdoc
+  # :include: doc/time/nsec.rdoc
+  # :include: doc/time/in.rdoc
+  #
+  def self.at(time, subsec = (nosubsec = true), unit = (nounit = true), in: nil)
+    __builtin.time_s_at(time, subsec, unit, __builtin.arg!(:in), nosubsec, nounit)
+  end
 
-class Time
   # Returns a new \Time object based the on given arguments.
   #
   # With no positional arguments, returns the value of Time.now:
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]