mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@63 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
de0e5e35ae
commit
01bb9da7ac
12 changed files with 288 additions and 115 deletions
21
time.c
21
time.c
|
@ -417,6 +417,23 @@ time_asctime(time)
|
|||
char buf[64];
|
||||
int len;
|
||||
|
||||
GetTimeval(time, tobj);
|
||||
if (tobj->tm_got == 0) {
|
||||
time_localtime(time);
|
||||
}
|
||||
len = strftime(buf, 64, "%c", &(tobj->tm));
|
||||
|
||||
return str_new(buf, len);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
time_to_s(time)
|
||||
VALUE time;
|
||||
{
|
||||
struct time_object *tobj;
|
||||
char buf[64];
|
||||
int len;
|
||||
|
||||
GetTimeval(time, tobj);
|
||||
if (tobj->tm_got == 0) {
|
||||
time_localtime(time);
|
||||
|
@ -774,8 +791,8 @@ Init_Time()
|
|||
rb_define_method(cTime, "gmtime", time_gmtime, 0);
|
||||
rb_define_method(cTime, "ctime", time_asctime, 0);
|
||||
rb_define_method(cTime, "asctime", time_asctime, 0);
|
||||
rb_define_method(cTime, "to_s", time_asctime, 0);
|
||||
rb_define_method(cTime, "inspect", time_asctime, 0);
|
||||
rb_define_method(cTime, "to_s", time_to_s, 0);
|
||||
rb_define_method(cTime, "inspect", time_to_s, 0);
|
||||
rb_define_method(cTime, "to_a", time_to_a, 0);
|
||||
|
||||
rb_define_method(cTime, "+", time_plus, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue