--- a/controls/DebugVariablePanel/DebugVariableItem.py Tue Dec 05 12:38:04 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableItem.py Fri Jan 12 17:56:48 2018 +0300
@@ -26,6 +26,7 @@
from __future__ import absolute_import
+from datetime import timedelta from graphics.DebugDataConsumer import DebugDataConsumer, TYPE_TRANSLATOR
# -------------------------------------------------------------------------------
@@ -219,18 +220,20 @@
Return if variable data type is numeric. String variables are
- considered as numeric (string CRC)
+ considered as numeric (string CRC). Time variables are considered @return: True if data type is numeric
return (self.Parent.IsNumType(self.VariableType) or
- self.VariableType in ["STRING", "WSTRING"])
+ self.VariableType in ["STRING", "WSTRING", "TIME", "TOD", "DT", "DATE"]) def NewValues(self, ticks, values):
@@ -253,10 +256,15 @@
# Translate forced flag to float for storing in Data table
forced_value = float(forced)
- # String data value is CRC
- num_value = (binascii.crc32(value) & STRING_CRC_MASK
- if self.VariableType in ["STRING", "WSTRING"]
+ if self.VariableType in ["STRING", "WSTRING"]: + # String data value is CRC + num_value = (binascii.crc32(value) & STRING_CRC_MASK) + elif self.VariableType in ["TIME", "TOD", "DT", "DATE"]: + # Numeric value of time type variables + # is represented in seconds + num_value = float(value.total_seconds()) + num_value = float(value) # Update variable range values
self.MinValue = (min(self.MinValue, num_value)
@@ -341,6 +349,9 @@
if self.VariableType in ["STRING", "WSTRING"] \
+ if self.VariableType in ["TIME", "TOD", "DT", "DATE"]: + value = timedelta(seconds=value) value = TYPE_TRANSLATOR.get(