From 38df1a90cc68d132306c9484ed57faa0be656b0e Mon Sep 17 00:00:00 2001 From: why Date: Fri, 30 May 2003 23:09:54 +0000 Subject: * ext/syck/rubyext.c (rb_syck_mktime): seconds calculated wrong. * ext/syck/gram.c: flexibility to anchors and transfer methods on collections. * ext/syck/token.c: hex escapes. * lib/yaml/basenode.rb: YamlNode references changed to YAML::BaseNode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/syck/rubyext.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'ext/syck/rubyext.c') diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index 60facd501e..4d5fdb18d6 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -147,7 +147,14 @@ rb_syck_mktime(str) // Millisecond ptr += 2; - usec = INT2FIX( strtod( ptr, NULL ) * 1000000 ); + if ( *ptr == '.' ) + { + usec = INT2FIX( strtod( ptr, NULL ) * 1000000 ); + } + else + { + usec = INT2FIX( 0 ); + } // Make UTC time time = rb_funcall(rb_cTime, s_utc, 7, year, mon, day, hour, min, sec, usec); @@ -156,9 +163,9 @@ rb_syck_mktime(str) while ( *ptr != 'Z' && *ptr != '+' && *ptr != '-' && *ptr != '\0' ) ptr++; if ( *ptr == '-' || *ptr == '+' ) { - long tz_offset = 0; + double tz_offset = 0; double utc_time = 0; - tz_offset += strtol(ptr, NULL, 10) * 3600; + tz_offset += strtod(ptr, NULL) * 3600; while ( *ptr != ':' && *ptr != '\0' ) ptr++; if ( *ptr == ':' ) @@ -166,11 +173,11 @@ rb_syck_mktime(str) ptr += 1; if ( tz_offset < 0 ) { - tz_offset -= strtol(ptr, NULL, 10) * 60; + tz_offset -= strtod(ptr, NULL) * 60; } else { - tz_offset += strtol(ptr, NULL, 10) * 60; + tz_offset += strtod(ptr, NULL) * 60; } } -- cgit v1.2.3