dialogs/DurationEditorDialog.py
changeset 2459 21164625b393
parent 2439 f0a040f1de1b
child 3303 0ffb41625592
--- a/dialogs/DurationEditorDialog.py	Fri Nov 23 11:01:20 2018 +0100
+++ b/dialogs/DurationEditorDialog.py	Fri Nov 23 12:13:24 2018 +0100
@@ -25,6 +25,7 @@
 
 
 from __future__ import absolute_import
+from __future__ import division
 import re
 
 import wx
@@ -40,7 +41,7 @@
 HOUR = 60 * MINUTE
 DAY = 24 * HOUR
 
-IEC_TIME_MODEL = re.compile("(?:T|TIME)#(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?$" % {"float": "[0-9]+(?:\.[0-9]+)?"})
+IEC_TIME_MODEL = re.compile(r"(?:T|TIME)#(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?$" % {"float": r"[0-9]+(?:\.[0-9]+)?"})
 
 
 # -------------------------------------------------------------------------------
@@ -139,10 +140,10 @@
 
         not_null = False
         duration = "T#"
-        for value, format in [((int(milliseconds) / DAY),             "%dd"),
-                              ((int(milliseconds) % DAY) / HOUR,      "%dh"),
-                              ((int(milliseconds) % HOUR) / MINUTE,   "%dm"),
-                              ((int(milliseconds) % MINUTE) / SECOND, "%ds")]:
+        for value, format in [((int(milliseconds) // DAY),             "%dd"),
+                              ((int(milliseconds) % DAY) // HOUR,      "%dh"),
+                              ((int(milliseconds) % HOUR) // MINUTE,   "%dm"),
+                              ((int(milliseconds) % MINUTE) // SECOND, "%ds")]:
 
             if value > 0 or not_null:
                 duration += format % value