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

* time.c (time_to_s): make it conform to RFC2822 date format.

[ruby-dev:29467]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-09-04 17:21:53 +00:00
parent eff9686ded
commit cbe89cef1a
2 changed files with 17 additions and 17 deletions

View file

@ -1,3 +1,8 @@
Mon Sep 4 23:15:34 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_to_s): make it conform to RFC2822 date format.
[ruby-dev:29467]
Mon Sep 4 21:43:57 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/dbm/extconf.rb: create makefile according to the result of check

13
time.c
View file

@ -1198,18 +1198,14 @@ time_to_s(VALUE time)
struct time_object *tobj;
char buf[128];
int len;
time_t off;
char buf2[32];
char sign = '+';
GetTimeval(time, tobj);
if (tobj->tm_got == 0) {
time_get_tm(time, tobj->gmt);
}
if (tobj->gmt == 1) {
len = strftime(buf, 128, "%a %b %d %H:%M:%S UTC %Y", &tobj->tm);
}
else {
time_t off;
char buf2[32];
char sign = '+';
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
off = tobj->tm.tm_gmtoff;
#else
@ -1220,10 +1216,9 @@ time_to_s(VALUE time)
sign = '-';
off = -off;
}
sprintf(buf2, "%%a %%b %%d %%H:%%M:%%S %c%02d%02d %%Y",
sprintf(buf2, "%%a, %%b %%d %%Y %%H:%%M:%%S %c%02d%02d",
sign, (int)(off/3600), (int)(off%3600/60));
len = strftime(buf, 128, buf2, &tobj->tm);
}
return rb_str_new(buf, len);
}