summaryrefslogtreecommitdiff
path: root/ext/syck/rubyext.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-30 23:09:54 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-30 23:09:54 +0000
commit38df1a90cc68d132306c9484ed57faa0be656b0e (patch)
tree82c9f4b85a92300e2c03f3dd4003c78e1bdfbc34 /ext/syck/rubyext.c
parent1ce0018ba1b26fcb5c8f294d2908a56ef0310464 (diff)
* 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
Diffstat (limited to 'ext/syck/rubyext.c')
-rw-r--r--ext/syck/rubyext.c17
1 files changed, 12 insertions, 5 deletions
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;
}
}