fix rounding milliseconds from nanoseconds
authorSurkov Sergey <surkovsv93@gmail.com>
Fri, 12 Jan 2018 18:33:54 +0300
changeset 1963 cded8d8a0485
parent 1962 f41dc3829af6
child 1964 b9318fc8f033
fix rounding milliseconds from nanoseconds

example:rounding 299999 ns to 300ms, if division result is an
integer, remainder will be lost, and result will be 299.
targets/typemapping.py
--- a/targets/typemapping.py	Fri Jan 12 17:56:48 2018 +0300
+++ b/targets/typemapping.py	Fri Jan 12 18:33:54 2018 +0300
@@ -54,7 +54,7 @@
 
 def _ttime():
     return (IEC_TIME,
-            lambda x: td(0, x.s, x.ns/1000),
+            lambda x: td(0, x.s, x.ns/1000.0),
             lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))