[#35789] [Ruby 1.9 - Bug #407] (Open) String#<< — Shyouhei Urabe <redmine@...>

チケット #407 が報告されました。 (by Shyouhei Urabe)

13 messages 2008/08/06

[#35845] [Bug #437] test_strftime(TestTime) fails on Solaris — Shugo Maeda <redmine@...>

Bug #437: test_strftime(TestTime) fails on Solaris

24 messages 2008/08/13
[#35855] Re: [Bug #437] test_strftime(TestTime) fails on Solaris — "Shugo Maeda" <shugo@...> 2008/08/15

前田です。

[#35856] Re: [Bug #437] test_strftime(TestTime) fails on Solaris — SATOH Fumiyasu <fumiyas@...> 2008/08/15

さとうふみやす @ OSS テクノロジです。

[#35857] Re: [Bug #437] test_strftime(TestTime) fails on Solaris — Yukihiro Matsumoto <matz@...> 2008/08/15

まつもと ゆきひろです

[#35870] Re: [Bug #437] test_strftime(TestTime) fails on Solaris — "Shugo Maeda" <shugo@...> 2008/08/18

前田です。

[#35863] Refactoring of enumerating prime numbers — "Yugui (Yuki Sonoda)" <yugui@...>

Yuguiです。

20 messages 2008/08/16
[#35865] Re: Refactoring of enumerating prime numbers — keiju@... (keiju ISHITSUKA) 2008/08/17

けいじゅ@いしつかです.

[#35867] Re: Refactoring of enumerating prime numbers — "Yugui (Yuki Sonoda)" <yugui@...> 2008/08/17

Yuguiです。

[#35875] Re: Refactoring of enumerating prime numbers — keiju@... (keiju ISHITSUKA) 2008/08/19

けいじゅ@いしつかです.

[#35877] Re: Refactoring of enumerating prime numbers — Nobuyoshi Nakada <nobu@...> 2008/08/19

なかだです。

[#35882] Re: Refactoring of enumerating prime numbers — keiju@... (石塚圭樹) 2008/08/20

けいじゅ@いしつかです.

[#35904] [Feature:1.9] pack format 'm' based on RFC 4648 — "Yusuke ENDOH" <mame@...>

遠藤です。

14 messages 2008/08/21
[#36442] [Feature #471] pack format 'm' based on RFC 4648 — Yuki Sonoda <redmine@...> 2008/09/22

チケット #471 が更新されました。 (by Yuki Sonoda)

[#35906] %N for Time#strftime — "Shugo Maeda" <shugo@...>

前田です。

13 messages 2008/08/21

[#35986] 1.9と1.8で、delegateのインスタンスのクラス名の違う — Fujioka <fuj@...>

xibbarこと藤岡です。

17 messages 2008/08/26
[#35987] Re: 1.9と1.8で、delegateのインスタンスのクラス名の違う — Yukihiro Matsumoto <matz@...> 2008/08/26

まつもと ゆきひろです

[#35991] Re: 1.9と1.8で、delegateのインスタンスのクラス名の違う — keiju@... (石塚圭樹) 2008/08/26

けいじゅ@いしつかです.

[#35994] Re: 1.9と1.8で、delegateのインスタンスのクラス名の違う — Fujioka <fuj@...> 2008/08/27

藤岡です。

[#35998] Re: 1.9と1.8で、delegateのインスタンスのクラス名の違う — keiju@... (石塚圭樹) 2008/08/27

けいじゅ@いしつかです.

[#36066] Numeric#scalar? — Tadayoshi Funaba <tadf@...>

1.9 の Numeric#scalar? について、適当でないのでは (real? などのほうがい

24 messages 2008/08/31
[#36069] Re: Numeric#scalar? — Shin-ichiro HARA <sinara@...> 2008/08/31

原です。

[#36104] Re: Numeric#scalar? — Tadayoshi Funaba <tadf@...> 2008/09/02

> やはり、scalar? はずれているんじゃないかな。real? の方がいい

[#36122] Re: Numeric#scalar? — Shin-ichiro HARA <sinara@...> 2008/09/03

原です。

[#36133] Re: Numeric#scalar? — Tadayoshi Funaba <tadf@...> 2008/09/03

> ここで、scalar? を疑問視する理由を復習すると、たとえば、「複

[#36173] Re: Numeric#scalar? — Tadayoshi Funaba <tadf@...> 2008/09/05

1.9.1 までに時間がないので scalar? だけ何とかしたいと思っていましたが、

[#36183] Re: Numeric#scalar? — "Shugo Maeda" <shugo@...> 2008/09/06

前田です。

[#36186] Re: Numeric#scalar? — Shin-ichiro HARA <sinara@...> 2008/09/06

原です。

[ruby-dev:35855] Re: [Bug #437] test_strftime(TestTime) fails on Solaris

From: "Shugo Maeda" <shugo@...>
Date: 2008-08-15 07:59:30 UTC
List: ruby-dev #35855
前田です。
# Redmineのレポート先を間違えてruby-devにしてしまったので日本語で。

2008/08/13 23:27 Shugo Maeda <redmine@ruby-lang.org>:
> strftime("%Z") seems always to return the local time zone.
>
>  $ ./ruby-trunk -e 'p Time.now.gmtime'
>  2008-08-13 14:27:31 UTC
>  $ ./ruby-trunk -e 'p Time.now.gmtime.strftime("%Z")'
>  "JST"

どうもSolarisだとstrftime(3)自体が常にローカルのタイムゾーン情報を
返すようです。
簡単な解決としては、添付のパッチのような方法しか思い付きませんでし
たが、もっと上手い解決方法があれば教えてください。
# ほんとは全部自前で実装するのがよいのでしょうが…。

-- 
Shugo Maeda

Attachments (1)

strftime.diff (1.6 KB, text/x-diff)
Index: time.c
===================================================================
--- time.c	(revision 18585)
+++ time.c	(working copy)
@@ -2106,6 +2106,16 @@
     if (!rb_enc_str_asciicompat_p(format)) {
 	rb_raise(rb_eArgError, "format should have ASCII compatible encoding");
     }
+#ifdef BROKEN_STRFTIME_Z
+    if (tobj->gmt) {
+	VALUE z_pat = rb_reg_new("%z", 2, 0);
+	VALUE z_val = rb_str_new2("+0000");
+	VALUE Z_pat = rb_reg_new("%Z", 2, 0);
+	VALUE Z_val = rb_str_new2("GMT");
+	format = rb_funcall(format, rb_intern("gsub"), 2, z_pat, z_val);
+	format = rb_funcall(format, rb_intern("gsub"), 2, Z_pat, Z_val);
+    }
+#endif
     format = rb_str_new4(format);
     fmt = RSTRING_PTR(format);
     len = RSTRING_LEN(format);
Index: configure.in
===================================================================
--- configure.in	(revision 18585)
+++ configure.in	(working copy)
@@ -922,6 +922,33 @@
   AC_DEFINE(NEGATIVE_TIME_T)
 fi
 
+AC_CACHE_CHECK(for %z/%Z support of strftime(3), rb_cv_strftime_z_works,
+  [AC_TRY_RUN([
+#include <time.h>
+#include <string.h>
+
+int
+main()
+{
+   time_t t = 0;
+   struct tm *tm;
+   char buf[10];
+
+   tm = gmtime(&t);
+   if (strftime(buf, sizeof(buf), "%z %Z", tm) == 0)
+       return 1;
+   if (strcmp(buf, "+0000 GMT") && strcmp(buf, "+0000 UTC"))
+       return 1;
+   return 0;
+}
+],
+	rb_cv_strftime_z_works=yes,
+	rb_cv_strftime_z_works=no,
+	rb_cv_strftime_z_works=yes)])
+if test "$rb_cv_strftime_z_works" = no; then
+  AC_DEFINE(BROKEN_STRFTIME_Z)
+fi
+
 if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
    AC_DEFINE(POSIX_SIGNAL)
 else

In This Thread