From: Michael Gernoth Date: Sun, 19 May 2013 10:36:16 +0000 (+0000) Subject: parse fractions and use absolute difference in calculation X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/fs20pcs/commitdiff_plain/3ca853944fcfaad16e603ac19fa45efc0094a24a?hp=f6d105d68b46ab635628b2d799085537146d762c parse fractions and use absolute difference in calculation --- diff --git a/fs20pcs.c b/fs20pcs.c index 3f64a41..431004f 100644 --- 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);