# HG changeset patch # User Manuele Conti # Date 1351030015 -7200 # Node ID b0ef6711f2a8e14b13c6fa72fde7c8638d8ec2dd # Parent 0307fa16db3f485a588728a1d12c3d361b9fbcb3 Fix some warning about loss of precision data in iec_std_lib.h file. diff -r 0307fa16db3f -r b0ef6711f2a8 lib/iec_std_lib.h --- a/lib/iec_std_lib.h Fri Oct 26 17:41:21 2012 +0100 +++ b/lib/iec_std_lib.h Wed Oct 24 00:06:55 2012 +0200 @@ -295,18 +295,18 @@ } static inline TIME __time_mul(TIME IN1, LREAL IN2){ LREAL s_f = IN1.tv_sec * IN2; - time_t s = s_f; - div_t ns = div((LREAL)IN1.tv_nsec * IN2, 1000000000); - TIME res = {s + ns.quot, - ns.rem + (s_f - s) * 1000000000 }; + time_t s = (time_t)s_f; + div_t ns = div((int)((LREAL)IN1.tv_nsec * IN2), 1000000000); + TIME res = {(long)s + ns.quot, + (long)ns.rem + (s_f - s) * 1000000000 }; __normalize_timespec(&res); return res; } static inline TIME __time_div(TIME IN1, LREAL IN2){ LREAL s_f = IN1.tv_sec / IN2; - time_t s = s_f; - TIME res = {s, - IN1.tv_nsec / IN2 + (s_f - s) * 1000000000 }; + time_t s = (time_t)s_f; + TIME res = {(long)s, + (long)(IN1.tv_nsec / IN2 + (s_f - s) * 1000000000) }; __normalize_timespec(&res); return res; } @@ -482,9 +482,9 @@ while(--l > 0 && IN.body[l] != '.'); if(l != 0){ LREAL IN_val = atof((const char *)&IN.body); - return (TIME){IN_val, (IN_val - (LINT)IN_val)*1000000000}; + return (TIME){(long)IN_val, (long)(IN_val - (LINT)IN_val)*1000000000}; }else{ - return (TIME){__pstring_to_sint(&IN), 0}; + return (TIME){(long)__pstring_to_sint(&IN), 0}; } }