diff options
author | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2002-07-23 10:45:25 +0000 |
---|---|---|
committer | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2002-07-23 10:45:25 +0000 |
commit | 9dab048c26f6b039a31d5d3030bf0c35af39f831 (patch) | |
tree | 5fc940cdf35b0858db8102a1338794303c73edb1 | |
parent | 95ca93a514b493ac6e93838d3f06a1c592b078a2 (diff) | |
download | ruby-openssl-history-9dab048c26f6b039a31d5d3030bf0c35af39f831.tar.gz |
* ossl.h: include <openssl/e_os.h>
* ossl.c: workaround to convert into UTC time.
* lib/openssl.rb: fix string embeded expression.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/openssl.rb | 2 | ||||
-rw-r--r-- | ossl.c | 18 | ||||
-rw-r--r-- | ossl.h | 1 |
4 files changed, 23 insertions, 3 deletions
@@ -4,6 +4,11 @@ Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz> All rights reserved. $Log$ +Revision 1.38 2002/07/23 10:45:25 gotoyuzo +* ossl.h: include <openssl/e_os.h> +* ossl.c: workaround to convert into UTC time. +* lib/openssl.rb: fix string embeded expression. + Revision 1.37 2002/04/07 16:35:32 majkl * Macros fixups * X509ExtFactory cleanup diff --git a/lib/openssl.rb b/lib/openssl.rb index d182220..4203d2a 100644 --- a/lib/openssl.rb +++ b/lib/openssl.rb @@ -284,7 +284,7 @@ end # defined? DH return if arg.nil? t = arg.class while t - method = "from_#{t.name.downcase.split("::").last}".intern + method = "from_#{t.name.downcase.split('::').last}".intern return send(method, arg, type) if respond_to?(method, true) t = t.superclass end @@ -54,7 +54,11 @@ VALUE asn1time_to_time(ASN1_UTCTIME *time) { struct tm tm; + time_t t; + char env[16]; + const char *tz; + memset(&tm, 0, sizeof(struct tm)); switch(time->type) { case V_ASN1_UTCTIME: if (!strptime(time->data, "%y%m%d%H%M%SZ", &tm)) { @@ -69,8 +73,18 @@ asn1time_to_time(ASN1_UTCTIME *time) default: rb_raise(rb_eTypeError, "unknown time format"); } - /*return rb_time_new(mktime(gmtime(mktime(&tm))), 0); * Is this correct? */ - return rb_time_new(mktime(&tm), 0); /* or this one? */ + + /* workaround to convert into UTC time */ + tz = getenv("TZ"); + putenv("TZ=UTC0"); + t = mktime(&tm); + if(!tz) unsetenv("TZ"); + else { + snprintf(env, sizeof(env), "TZ=%s", tz); + putenv(env); + } + + return rb_time_new(t, 0); } /* @@ -25,6 +25,7 @@ extern "C" { #include <openssl/ssl.h> #include <openssl/hmac.h> #include <openssl/rand.h> +#include <openssl/e_os.h> #if defined(NT) # undef OpenFile #endif |