summaryrefslogtreecommitdiffstats
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-27 07:53:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-27 07:53:18 +0000
commitd0a297acb760c28aba45208f89c802668677c592 (patch)
tree481b675e97fe10eafbf54e0bde3e9fe8f040128c /time.c
parentb8d7bc8bb7339ce5a3ab1fcb7f92c7a35bbc4f6c (diff)
downloadruby-d0a297acb760c28aba45208f89c802668677c592.tar.gz
ruby-d0a297acb760c28aba45208f89c802668677c592.tar.xz
ruby-d0a297acb760c28aba45208f89c802668677c592.zip
* time.c (time_to_s): use +0900 style timezone string for local time.
[ruby-dev:29143] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/time.c b/time.c
index d0c2de4a8..72dae4516 100644
--- a/time.c
+++ b/time.c
@@ -1261,7 +1261,22 @@ time_to_s(time)
len = strftime(buf, 128, "%a %b %d %H:%M:%S UTC %Y", &tobj->tm);
}
else {
- len = strftime(buf, 128, "%a %b %d %H:%M:%S %Z %Y", &tobj->tm);
+ time_t off;
+ char buf2[32];
+ char sign = '+';
+#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
+ off = tobj->tm.tm_gmtoff;
+#else
+ VALUE tmp = time_utc_offset(time);
+ off = NUM2INT(tmp);
+#endif
+ if (off < 0) {
+ sign = '-';
+ off = -off;
+ }
+ sprintf(buf2, "%%a %%b %%d %%H:%%M:%%S %c%02d%02d %%Y",
+ sign, off/3600, off%3600/60);
+ len = strftime(buf, 128, buf2, &tobj->tm);
}
return rb_str_new(buf, len);
}