ruby-changes:7488
From: usa <ko1@a...>
Date: Mon, 1 Sep 2008 02:58:32 +0900 (JST)
Subject: [ruby-changes:7488] Ruby:r19008 (trunk): * strftime.c (rb_strftime): calc timezone offset by myself if system
usa 2008-09-01 02:58:13 +0900 (Mon, 01 Sep 2008) New Revision: 19008 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19008 Log: * strftime.c (rb_strftime): calc timezone offset by myself if system doesn't provide timezone info. Modified files: trunk/ChangeLog trunk/strftime.c Index: ChangeLog =================================================================== --- ChangeLog (revision 19007) +++ ChangeLog (revision 19008) @@ -1,3 +1,8 @@ +Mon Sep 1 02:55:15 2008 NAKAMURA Usaku <usa@r...> + + * strftime.c (rb_strftime): calc timezone offset by myself if system + doesn't provide timezone info. + Mon Sep 1 02:48:28 2008 Tanaka Akira <akr@f...> * tool/transcode-tblgen.rb: change "illegal" to "invalid". Index: strftime.c =================================================================== --- strftime.c (revision 19007) +++ strftime.c (revision 19008) @@ -477,6 +477,15 @@ #ifdef HAVE_GETTIMEOFDAY gettimeofday(&tv, &zone); off = -zone.tz_minuteswest; +#else + /* no timezone info, then calc by myself */ + { + struct tm utc; + time_t now; + time(&now); + utc = *gmtime(&now); + off = (now - mktime(&utc)) / 60; + } #endif #endif /* !HAVE_TIMEZONE */ #endif /* !HAVE_TM_ZONE */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/