From d96743c7f5cc2e08966b1f4059af5a9c27c1d806 Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 31 Aug 2008 17:58:13 +0000 Subject: * strftime.c (rb_strftime): calc timezone offset by myself if system doesn't provide timezone info. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- strftime.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'strftime.c') diff --git a/strftime.c b/strftime.c index e559c05dd..0f5214990 100644 --- a/strftime.c +++ b/strftime.c @@ -477,6 +477,15 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept #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 */ -- cgit