1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
akr 2009-06-24 11:19:58 +00:00
parent 62c885753c
commit c6480cd096
2 changed files with 20 additions and 1 deletions

View file

@ -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

17
time.c
View file

@ -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);