diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-08 07:03:09 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-08 07:03:09 +0000 |
commit | d497898c231f124ba187e2650be8af20b47b1a97 (patch) | |
tree | d7fbdd608eb0698296838406ea964328994e342c /time.c | |
parent | d41f53d0b6ceaec8b9fffc9f79ee9335b2a25175 (diff) | |
download | ruby-d497898c231f124ba187e2650be8af20b47b1a97.tar.gz |
* eval.c (cvar_cbase): utility function to find innermost non
singleton cbase.
* eval.c (is_defined): adopt new cvar behavior.
* eval.c (rb_eval): ditto.
* eval.c (assign): ditto.
* class.c (rb_mod_clone): should not call rb_obj_clone(), since
Module does not provide "allocate".
* class.c (rb_singleton_class): should crate new singleton class
if obj is a class or module and attached object is different,
which means metaclass of singleton class is sought.
* time.c (time_s_alloc): now follows allocation framework.
* eval.c (rb_eval): should initialize outer class variables from
methods in singleton class definitions.
* eval.c (assign): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -45,7 +45,7 @@ struct time_object { } static VALUE -time_s_now(klass) +time_s_alloc(klass) VALUE klass; { VALUE obj; @@ -53,7 +53,6 @@ time_s_now(klass) obj = Data_Make_Struct(klass, struct time_object, 0, free, tobj); tobj->tm_got=0; - if (gettimeofday(&tobj->tv, 0) < 0) { rb_sys_fail("gettimeofday"); } @@ -61,6 +60,14 @@ time_s_now(klass) return obj; } +static VALUE +time_s_now(klass) + VALUE klass; +{ + return rb_obj_alloc(klass); +} + + #define NDIV(x,y) (-(-((x)+1)/(y))-1) #define NMOD(x,y) ((y)-(-((x)+1)%(y))-1) @@ -1413,7 +1420,7 @@ Init_Time() rb_include_module(rb_cTime, rb_mComparable); rb_define_singleton_method(rb_cTime, "now", time_s_now, 0); - rb_define_singleton_method(rb_cTime, "allocate", time_s_now, 0); + rb_define_singleton_method(rb_cTime, "allocate", time_s_alloc, 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); |