Index: trunk/src/tmcsim/application.properties
===================================================================
--- trunk/src/tmcsim/application.properties	(revision 469)
+++ trunk/src/tmcsim/application.properties	(revision 471)
@@ -1,5 +1,5 @@
-#Sat, 27 Jul 2019 22:04:01 -0700
+#Mon, 29 Jul 2019 14:47:09 -0700
 
-Application.revision=467
+Application.revision=470
 
-Application.buildnumber=176
+Application.buildnumber=177
Index: trunk/src/tmcsim/cadsimulator/Coordinator.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 466)
+++ trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 471)
@@ -837,5 +837,7 @@
             public int compare(String o1, String o2) 
             {
-                return extractInt(o1) - extractInt(o2);
+                // extract just the timestamp from the strings and convert them to int
+                // fixes #181
+                return extractInt(o1.substring(0,8)) - extractInt(o2.substring(0,8));
             }
             // extract an integer from a String    
@@ -843,6 +845,14 @@
             {   // remove all non-digits
                 String num = s.replaceAll("\\D", "");
-                // return 0 if no digits found, else return the number
-                return num.isEmpty() ? 0 : Integer.parseInt(num);
+                try
+                {
+                    // return 0 if no digits found, else return the number
+                    return num.isEmpty() ? 0 : Integer.parseInt(num);
+                } catch (NumberFormatException ex)
+                {
+                    System.out.println("Can't convert "+s+" to integer in writeToCAD. " + 
+                    ex.getMessage());
+                    return 0;
+                }
             }
         });
Index: trunk/src/python/unifiedlogger/logging_service.py
===================================================================
--- trunk/src/python/unifiedlogger/logging_service.py	(revision 466)
+++ trunk/src/python/unifiedlogger/logging_service.py	(revision 471)
@@ -4,18 +4,23 @@
 
 outputFilename = "unifiedlog.csv"
-
+seconds = 0
+# convert seconds to H:MM:SS
+def toHMS(seconds):
+    m, s = divmod(int(seconds), 60)
+    h, m = divmod(m, 60)
+    return  "%d:%02d:%02d" % (h, m, s)    
+    
 # Load the sim time file and extract the seconds */
 def getSimTime():
+    global seconds    
     with open ("webapps/dynamicdata/sim_elapsedtime.json", 'r') as myfile:
         jsonData=myfile.read()
-    seconds = 0
     try:     
        seconds = json.loads(jsonData)['elapsedtime']
     except:
-       print "Error loading json for elapsed time"
+       print "Unable to read sim time. ",
+       print "Proceeding with previous time: ", toHMS(seconds)
     # convert seconds to H:MM:SS
-    m, s = divmod(int(seconds), 60)
-    h, m = divmod(m, 60)
-    return  "%d:%02d:%02d" % (h, m, s)    
+    return toHMS(seconds)
 
 def startup():
Index: trunk/src/python/unifiedlogger/wing_project.wpr
===================================================================
--- trunk/src/python/unifiedlogger/wing_project.wpr	(revision 470)
+++ trunk/src/python/unifiedlogger/wing_project.wpr	(revision 471)
@@ -46,5 +46,5 @@
                  'full-screen': False,
                  'notebook_display': 'normal',
-                 'notebook_percent': 0.3472840605520926,
+                 'notebook_percent': 0.2564559216384684,
                  'override_title': None,
                  'pagelist': [('source-assistant',
@@ -86,5 +86,5 @@
                           1],
         'notebook_display': 'hidden',
-        'notebook_percent': 0.0,
+        'notebook_percent': 0.30000000000000004,
         'override_title': None,
         'pagelist': [('batch-search',
@@ -183,112 +183,16 @@
                        'toolbox-percent': 1.0,
                        'toolbox-tree-sel': ''})],
-        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('activitylog_watcher.py'),
-        {'attrib-starts': [('getLogEntries|0|',
-                            42)],
-         'code-line': '    return currList\n',
-         'first-line': 37L,
+        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('cad_watcher.py'),
+        {'attrib-starts': [('isFull|0|',
+                            16)],
+         'code-line': '\n',
+         'first-line': 27L,
          'folded-linenos': [],
-         'sel-line': 48L,
-         'sel-line-start': 1427L,
-         'selection_end': 1427L,
-         'selection_start': 1427L,
+         'sel-line': 18L,
+         'sel-line-start': 559L,
+         'selection_end': 559L,
+         'selection_start': 559L,
          'zoom': 0L},
-        1563915907.118035],
-        [loc('logging_service.py'),
-         {'attrib-starts': [('startup|0|',
-                             20)],
-          'code-line': '                trimmed_item = item.strip()\n',
-          'first-line': 50L,
-          'folded-linenos': [],
-          'sel-line': 57L,
-          'sel-line-start': 1955L,
-          'selection_end': 1955L,
-          'selection_start': 1955L,
-          'zoom': 0L},
-         1563915945.26135],
-        [loc('activitylog_watcher.py'),
-         {'attrib-starts': [('getLogEntries|0|',
-                             42)],
-          'code-line': '    currList = []\n',
-          'first-line': 37L,
-          'folded-linenos': [],
-          'sel-line': 45L,
-          'sel-line-start': 1303L,
-          'selection_end': 1303L,
-          'selection_start': 1303L,
-          'zoom': 0L},
-         1563916207.12504],
-        [loc('cms_watcher.py'),
-         {'attrib-starts': [('readFile|0|',
-                             18)],
-          'code-line': ' \n',
-          'first-line': 6L,
-          'folded-linenos': [],
-          'sel-line': 21L,
-          'sel-line-start': 564L,
-          'selection_end': 565L,
-          'selection_start': 565L,
-          'zoom': 0L},
-         1563916220.372856],
-        [loc('activitylog_watcher.py'),
-         {'attrib-starts': [('getLogEntries|0|',
-                             42)],
-          'code-line': '    resultList = []\n',
-          'first-line': 40L,
-          'folded-linenos': [],
-          'sel-line': 48L,
-          'sel-line-start': 1422L,
-          'selection_end': 1422L,
-          'selection_start': 1422L,
-          'zoom': 0L},
-         1564099965.745285],
-        [loc('cad_watcher.py'),
-         {'attrib-starts': [('isFull|0|',
-                             16)],
-          'code-line': '\n',
-          'first-line': 3L,
-          'folded-linenos': [],
-          'sel-line': 18L,
-          'sel-line-start': 559L,
-          'selection_end': 559L,
-          'selection_start': 559L,
-          'zoom': 0L},
-         1564102192.752733],
-        [loc('__main__.py'),
-         {'attrib-starts': [],
-          'code-line': 'import logging_service, os, ConfigParser\n',
-          'first-line': 0L,
-          'folded-linenos': [],
-          'sel-line': 0L,
-          'sel-line-start': 0L,
-          'selection_end': 40L,
-          'selection_start': 28L,
-          'zoom': 0L},
-         1564182621.22245],
-        [loc('logging_service.py'),
-         {'attrib-starts': [('startup|0|',
-                             20)],
-          'code-line': '            # dynamically load the get log function '\
-                       'for this plugin\n',
-          'first-line': 38L,
-          'folded-linenos': [],
-          'sel-line': 49L,
-          'sel-line-start': 1561L,
-          'selection_end': 1603L,
-          'selection_start': 1603L,
-          'zoom': 0L},
-         1564182682.881746],
-        [loc('cad_watcher.py'),
-         {'attrib-starts': [('isFull|0|',
-                             16)],
-          'code-line': '\n',
-          'first-line': 27L,
-          'folded-linenos': [],
-          'sel-line': 18L,
-          'sel-line-start': 559L,
-          'selection_end': 559L,
-          'selection_start': 559L,
-          'zoom': 0L},
-         1564182715.806107],
+        1564182715.806107],
         [loc('logging_service.py'),
          {'attrib-starts': [('startup|0|',
@@ -424,7 +328,110 @@
           'selection_start': 1613L,
           'zoom': 0L},
-         1564324057.330601]],
+         1564324057.330601],
+        [loc('activitylog_watcher.py'),
+         {'attrib-starts': [('getLogEntries|0|',
+                             42)],
+          'code-line': '        desiredFields = "Activity Log.,"+name+","+co'\
+                       'de+","+msg\n',
+          'first-line': 33L,
+          'folded-linenos': [],
+          'sel-line': 55L,
+          'sel-line-start': 1666L,
+          'selection_end': 1728L,
+          'selection_start': 1728L,
+          'zoom': 0L},
+         1564408367.809524],
+        [loc('cad_watcher.py'),
+         {'attrib-starts': [('getLogEntries|0|',
+                             24)],
+          'code-line': "            msgList = text_file.read().split('\\n')"\
+                       "\n",
+          'first-line': 38L,
+          'folded-linenos': [],
+          'sel-line': 52L,
+          'sel-line-start': 1613L,
+          'selection_end': 1613L,
+          'selection_start': 1613L,
+          'zoom': 0L},
+         1564408386.133798],
+        [loc('logging_service.py'),
+         {'attrib-starts': [('startup|0|',
+                             20)],
+          'code-line': '    #       Append simulation time and the log entri'\
+                       'es to the Output Buffer\n',
+          'first-line': 15L,
+          'folded-linenos': [],
+          'sel-line': 55L,
+          'sel-line-start': 1843L,
+          'selection_end': 1851L,
+          'selection_start': 1851L,
+          'zoom': 0L},
+         1564408404.830956],
+        [loc('cad_watcher.py'),
+         {'attrib-starts': [('getLogEntries|0|',
+                             24)],
+          'code-line': '            print pathToLog + " missing: assuming re'\
+                       'set."\n',
+          'first-line': 35L,
+          'folded-linenos': [],
+          'sel-line': 37L,
+          'sel-line-start': 1087L,
+          'selection_end': 1143L,
+          'selection_start': 1143L,
+          'zoom': 0L},
+         1564436972.290038],
+        [loc('logging_service.py'),
+         {'attrib-starts': [('startup|0|',
+                             20)],
+          'code-line': '    #       Append simulation time and the log entri'\
+                       'es to the Output Buffer\n',
+          'first-line': 0L,
+          'folded-linenos': [],
+          'sel-line': 55L,
+          'sel-line-start': 1843L,
+          'selection_end': 1851L,
+          'selection_start': 1851L,
+          'zoom': 0L},
+         1564436998.714792],
+        [loc('cad_watcher.py'),
+         {'attrib-starts': [('getLogEntries|0|',
+                             24)],
+          'code-line': '            print pathToLog + " missing: assuming re'\
+                       'set."\n',
+          'first-line': 20L,
+          'folded-linenos': [],
+          'sel-line': 37L,
+          'sel-line-start': 1087L,
+          'selection_end': 1143L,
+          'selection_start': 1143L,
+          'zoom': 0L},
+         1564437041.061947],
+        [loc('logging_service.py'),
+         {'attrib-starts': [('getSimTime|0|',
+                             13)],
+          'code-line': '\n',
+          'first-line': 0L,
+          'folded-linenos': [],
+          'sel-line': 24L,
+          'sel-line-start': 789L,
+          'selection_end': 789L,
+          'selection_start': 789L,
+          'zoom': 0L},
+         1564438151.528836],
+        [loc('cad_watcher.py'),
+         {'attrib-starts': [('getLogEntries|0|',
+                             24)],
+          'code-line': '            print pathToLog + " missing: assuming re'\
+                       'set."\n',
+          'first-line': 32L,
+          'folded-linenos': [],
+          'sel-line': 37L,
+          'sel-line-start': 1087L,
+          'selection_end': 1143L,
+          'selection_start': 1143L,
+          'zoom': 0L},
+         1564438185.449366]],
         20),
-        'current-loc': loc('activitylog_watcher.py'),
+        'current-loc': loc('logging_service.py'),
         'editor-state-list': [(loc('activitylog_watcher.py'),
                                {'attrib-starts': [('getLogEntries|0|',
@@ -442,12 +449,12 @@
                                {'attrib-starts': [('getLogEntries|0|',
         24)],
-                                'code-line': "            msgList = text_fil"\
-        "e.read().split('\\n')\n",
-                                'first-line': 29L,
+                                'code-line': '            print pathToLog + '\
+        '" missing: assuming reset."\n',
+                                'first-line': 32L,
                                 'folded-linenos': [],
-                                'sel-line': 52L,
-                                'sel-line-start': 1613L,
-                                'selection_end': 1613L,
-                                'selection_start': 1613L,
+                                'sel-line': 37L,
+                                'sel-line-start': 1087L,
+                                'selection_end': 1143L,
+                                'selection_start': 1143L,
                                 'zoom': 0L}),
                               (loc('cms_watcher.py'),
@@ -473,14 +480,14 @@
                                 'zoom': 0L}),
                               (loc('logging_service.py'),
-                               {'attrib-starts': [('startup|0|',
-        20)],
-                                'code-line': '    #       Append simulation '\
-        'time and the log entries to the Output Buffer\n',
-                                'first-line': 21L,
+                               {'attrib-starts': [('getSimTime|0|',
+        13)],
+                                'code-line': '       print "Proceeding with '\
+        'previous time: ", toHMS(seconds)\n',
+                                'first-line': 0L,
                                 'folded-linenos': [],
-                                'sel-line': 55L,
-                                'sel-line-start': 1843L,
-                                'selection_end': 1851L,
-                                'selection_start': 1851L,
+                                'sel-line': 21L,
+                                'sel-line-start': 649L,
+                                'selection_end': 649L,
+                                'selection_start': 649L,
                                 'zoom': 0L}),
                               (loc('__main__.py'),
@@ -495,5 +502,5 @@
                                 'selection_start': 28L,
                                 'zoom': 0L})],
-        'has-focus': False,
+        'has-focus': True,
         'locked': False},
         [loc('activitylog_watcher.py'),
@@ -506,7 +513,7 @@
         u'__main__.py',
         u'cms_watcher.py',
-        u'logging_service.py',
+        u'activitylog_watcher.py',
         u'cad_watcher.py',
-        u'activitylog_watcher.py']},
+        u'logging_service.py']},
         'saved_notebook_display': None,
         'split_percents': {0: 0.5},
@@ -515,5 +522,5 @@
         'traversal_pos': ((0,
                            3),
-                          1564287665.60169),
+                          1564437523.022983),
         'user_data': {}},
                  'saved_notebook_display': None,
@@ -523,5 +530,5 @@
                  'traversal_pos': ((0,
                                     4),
-                                   1564325707.122876),
+                                   1564438041.344573),
                  'user_data': {}},
         'window-alloc': (29,
@@ -529,7 +536,7 @@
                          1197,
                          722)}]}
-guimgr.recent-documents = [loc('activitylog_watcher.py'),
+guimgr.recent-documents = [loc('logging_service.py'),
                            loc('cad_watcher.py'),
-                           loc('logging_service.py'),
+                           loc('activitylog_watcher.py'),
                            loc('__main__.py'),
                            loc('cms_watcher.py'),
Index: trunk/src/python/unifiedlogger/cad_watcher.py
===================================================================
--- trunk/src/python/unifiedlogger/cad_watcher.py	(revision 467)
+++ trunk/src/python/unifiedlogger/cad_watcher.py	(revision 471)
@@ -36,5 +36,5 @@
         if ex.errno == 2:
             # 'No such file or directory
-            print pathToLog + " missing: assuming reset"
+            print pathToLog + " missing: assuming reset."
             lastLineNum = 0   #Start over
             return []
@@ -48,5 +48,5 @@
         if fileSize == 0:
             # Assume this is a read sync problem: Don't modify lastLineNum
-            print pathToLog+" is empty."
+            print pathToLog+" is empty, ignoring."
             return []
         else: # file is good, read it.
