# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1496317034 -10800
# Node ID 85fdcc04da25fb2e89a5de1d9a5e7bbcaf53cc7c
# Parent  578a46fb6b304d674390e2372efeaf3d55095e06
disallow setting IEC location addresses for TIME, DATE, DT and TOD variables

Size of these types is not defined and depends on the implementation
(IEC 61131-3 2.3.1).

diff -r 578a46fb6b30 -r 85fdcc04da25 PLCControler.py
--- a/PLCControler.py	Tue May 30 17:09:33 2017 +0300
+++ b/PLCControler.py	Thu Jun 01 14:37:14 2017 +0300
@@ -1789,6 +1789,10 @@
         if isinstance(typename, TupleType) or self.GetBlockType(typename) is not None:
             return False
 
+        # the size of these types is implementation dependend
+        if typename in ["TIME", "DATE", "DT", "TOD"]:
+            return False
+        
         datatype = self.GetDataType(typename, debug)
         if datatype is not None:
             return self.IsLocatableDataType(datatype)