diff -r b4a1ba9dbaf3 -r cc7a46953471 controls/DebugVariablePanel/DebugVariableItem.py --- a/controls/DebugVariablePanel/DebugVariableItem.py Thu Mar 01 14:28:55 2018 +0100 +++ b/controls/DebugVariablePanel/DebugVariableItem.py Fri Mar 02 17:01:25 2018 +0100 @@ -24,6 +24,7 @@ from __future__ import absolute_import +from datetime import timedelta import binascii import numpy from graphics.DebugDataConsumer import DebugDataConsumer, TYPE_TRANSLATOR @@ -219,18 +220,20 @@ else: self.Data = None - + self.MinValue = None + self.MaxValue = None # Init variable value self.Value = "" def IsNumVariable(self): """ Return if variable data type is numeric. String variables are - considered as numeric (string CRC) + considered as numeric (string CRC). Time variables are considered + as number of seconds @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"] - else float(value)) + 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()) + else: + 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"] \ else self.Data[idx, 1:3] + if self.VariableType in ["TIME", "TOD", "DT", "DATE"]: + value = timedelta(seconds=value) + # Get raw value if asked if not raw: value = TYPE_TRANSLATOR.get(