From c6480cd096da34cd36bea89d0a9b44577ca69570 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 24 Jun 2009 11:19:58 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ time.c | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) 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 + + * time.c (time_s_now): new function. Time.now don't take arguments. + Wed Jun 24 16:08:03 2009 NAKAMURA Usaku * 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 @@ -1617,6 +1617,21 @@ rb_time_timespec(VALUE time) return time_timespec(time, Qfalse); } +/* + * 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 @@ -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);