aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--time.c17
2 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c6ec113112..e99789ebcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jun 24 20:19:11 2009 Tanaka Akira <akr@fsij.org>
+
+ * time.c (time_s_now): new function. Time.now don't take arguments.
+
Wed Jun 24 16:08:03 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/resource.rb: CONFIG["TEENY"] is not ruby's version but API's
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);