]> git.zerfleddert.de Git - fs20pcs/commitdiff
parse fractions and use absolute difference in calculation
authorMichael Gernoth <michael@gernoth.net>
Sun, 19 May 2013 10:36:16 +0000 (10:36 +0000)
committerMichael Gernoth <michael@gernoth.net>
Sun, 19 May 2013 10:36:16 +0000 (10:36 +0000)
fs20pcs.c

index 3f64a4123ef53046e62f440474dcbc9870e23033..431004fbc8afe1c91bc13c9ddf5f4edf75234392 100644 (file)
--- a/fs20pcs.c
+++ b/fs20pcs.c
@@ -322,7 +322,7 @@ int parse_extension(char *ext)
                uint8_t low = 0;
                uint8_t i;
 
-               t = strtoul(ext, &ep, 10);
+               t = strtod(ext, &ep);
                if ((*ep != 's') && (*ep != 'S')) {
                        fprintf(stderr, "Not a valid time in seconds: %s\n", ext);
                        return -1;
@@ -358,7 +358,7 @@ int parse_extension(char *ext)
                        if (i_l > 12)
                                i_l = 12;
 
-                       d = l - i_l;
+                       d = fabs(l - i_l);
 
 #ifdef DEBUG
                        printf("d: %f\n", d);
Impressum, Datenschutz