aboutsummaryrefslogtreecommitdiffstats
path: root/ext/syck/rubyext.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/syck/rubyext.c')
-rw-r--r--ext/syck/rubyext.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
index cdf184c432..c54deea618 100644
--- a/ext/syck/rubyext.c
+++ b/ext/syck/rubyext.c
@@ -482,6 +482,31 @@ yaml_org_handler( n, ref )
syck_str_blow_away_commas( n );
obj = rb_cstr2inum( n->data.str->ptr, 10 );
}
+ else if ( strcmp( type_id, "float#base60" ) == 0 )
+ {
+ char *ptr, *end;
+ long sixty = 1;
+ double total = 0.0;
+ syck_str_blow_away_commas( n );
+ ptr = n->data.str->ptr;
+ end = n->data.str->ptr + n->data.str->len;
+ while ( end > ptr )
+ {
+ double bnum = 0;
+ char *colon = end - 1;
+ while ( colon >= ptr && *colon != ':' )
+ {
+ colon--;
+ }
+ if ( *colon == ':' ) *colon = '\0';
+
+ bnum = strtod( colon + 1, NULL );
+ total += bnum * sixty;
+ sixty *= 60;
+ end = colon;
+ }
+ obj = rb_float_new( total );
+ }
else if ( strcmp( type_id, "float#nan" ) == 0 )
{
obj = rb_float_new( S_nan() );