summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-24 11:19:58 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-24 11:19:58 +0000
commitc6480cd096da34cd36bea89d0a9b44577ca69570 (patch)
tree1f6e0a727e2c5c396c2f7ac0b7486016bb425e76 /time.c
parent62c885753c9ebb5f8eaeccf1eca1d7d5726f5188 (diff)
* time.c (time_s_now): new function. Time.now don't take arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/time.c b/time.c
index 20b1b92376..d856fc6f44 100644
--- a/time.c
+++ b/time.c
@@ -1619,6 +1619,21 @@ rb_time_timespec(VALUE time)
/*
* call-seq:
+ * Time.now => time
+ *
+ * Creates a new time object for the current time.
+ *
+ * Time.now #=> 2009-06-24 12:39:54 +0900
+ */
+
+static VALUE
+time_s_now(VALUE klass)
+{
+ return rb_class_new_instance(0, NULL, klass);
+}
+
+/*
+ * call-seq:
* Time.at(time) => time
* Time.at(seconds_with_frac) => time
* Time.at(seconds, microseconds_with_frac) => time
@@ -3728,7 +3743,7 @@ Init_Time(void)
rb_include_module(rb_cTime, rb_mComparable);
rb_define_alloc_func(rb_cTime, time_s_alloc);
- rb_define_singleton_method(rb_cTime, "now", rb_class_new_instance, -1);
+ rb_define_singleton_method(rb_cTime, "now", time_s_now, 0);
rb_define_singleton_method(rb_cTime, "at", time_s_at, -1);
rb_define_singleton_method(rb_cTime, "utc", time_s_mkutc, -1);
rb_define_singleton_method(rb_cTime, "gm", time_s_mkutc, -1);