summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-17 04:26:51 (GMT)
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-17 04:26:51 (GMT)
commite2cb0eded4813acb980b355321c2e56e82755f4c (patch)
tree32ccac9851e7dd51a86ffaf374a2734154070cb6 /ext/date
parent06af07dd7b6af4e98f70074cb003eca965c17e37 (diff)
ext/date/extconf.rb: check for timezone and altzone
Instead of in configure.in. As of r28592 the HAVE_VAR_TIMEZONE and HAVE_VAR_ALTZONE macros are only used by ext/date. ext/date doesn't care whether they are int or long, so just check for the existence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_core.c4
-rw-r--r--ext/date/extconf.rb5
2 files changed, 7 insertions, 2 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index dce0bf9..3b18bbd 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -7710,8 +7710,8 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
s = 59;
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
of = tm.tm_gmtoff;
-#elif defined(HAVE_VAR_TIMEZONE)
-#ifdef HAVE_VAR_ALTZONE
+#elif defined(HAVE_TIMEZONE)
+#ifdef HAVE_ALTZONE
of = (long)-((tm.tm_isdst > 0) ? altzone : timezone);
#else
of = (long)-timezone;
diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb
index a4f243e..8938df1 100644
--- a/ext/date/extconf.rb
+++ b/ext/date/extconf.rb
@@ -1,4 +1,9 @@
# frozen_string_literal: true
require 'mkmf'
+
config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
+
+have_var("timezone", "time.h")
+have_var("altzone", "time.h")
+
create_makefile('date_core')