Index: trunk/src/python/unifiedlogger/wing_project.wpr
===================================================================
--- trunk/src/python/unifiedlogger/wing_project.wpr	(revision 462)
+++ trunk/src/python/unifiedlogger/wing_project.wpr	(revision 465)
@@ -183,39 +183,15 @@
                        'toolbox-percent': 1.0,
                        'toolbox-tree-sel': ''})],
-        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('logging_service.py'),
-        {'attrib-starts': [('getSimTime|0|',
-                            7)],
-         'code-line': '       print "Error loading json for elapsed time"\n',
-         'first-line': 0L,
+        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('activitylog_watcher.py'),
+        {'attrib-starts': [],
+         'code-line': '# Local main for unit testing\n',
+         'first-line': 48L,
          'folded-linenos': [],
-         'sel-line': 14L,
-         'sel-line-start': 410L,
-         'selection_end': 460L,
-         'selection_start': 460L,
+         'sel-line': 50L,
+         'sel-line-start': 1431L,
+         'selection_end': 1460L,
+         'selection_start': 1460L,
          'zoom': 0L},
-        1563914714.187541],
-        [loc('cad_watcher.py'),
-         {'attrib-starts': [('isFull|0|',
-                             16)],
-          'code-line': '\n',
-          'first-line': 18L,
-          'folded-linenos': [],
-          'sel-line': 18L,
-          'sel-line-start': 559L,
-          'selection_end': 559L,
-          'selection_start': 559L,
-          'zoom': 0L},
-         1563914983.485065],
-        [loc('activitylog_watcher.py'),
-         {'attrib-starts': [],
-          'code-line': '# Local main for unit testing\n',
-          'first-line': 48L,
-          'folded-linenos': [],
-          'sel-line': 50L,
-          'sel-line-start': 1431L,
-          'selection_end': 1460L,
-          'selection_start': 1460L,
-          'zoom': 0L},
-         1563915276.741928],
+        1563915276.741928],
         [loc('../../../../../../../../usr/lib/python2.7/ConfigParser.py'),
          {'attrib-starts': [('ConfigParser|0|',
@@ -422,7 +398,31 @@
           'selection_start': 565L,
           'zoom': 0L},
-         1563916220.372856]],
+         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]],
         20),
-        'current-loc': loc('activitylog_watcher.py'),
+        'current-loc': loc('__main__.py'),
         'editor-state-list': [(loc('activitylog_watcher.py'),
                                {'attrib-starts': [('getLogEntries|0|',
@@ -440,5 +440,5 @@
         16)],
                                 'code-line': '\n',
-                                'first-line': 18L,
+                                'first-line': 3L,
                                 'folded-linenos': [],
                                 'sel-line': 18L,
@@ -500,9 +500,9 @@
          loc('__main__.py')]),
                                'open_files': [u'../../../config/logging_service.cfg',
-        u'__main__.py',
-        u'cad_watcher.py',
         u'cms_watcher.py',
         u'logging_service.py',
-        u'activitylog_watcher.py']},
+        u'activitylog_watcher.py',
+        u'cad_watcher.py',
+        u'__main__.py']},
         'saved_notebook_display': None,
         'split_percents': {0: 0.5},
@@ -519,5 +519,5 @@
                  'traversal_pos': ((0,
                                     4),
-                                   1563917662.000223),
+                                   1564102198.163837),
                  'user_data': {}},
         'window-alloc': (29,
@@ -525,9 +525,9 @@
                          1197,
                          722)}]}
-guimgr.recent-documents = [loc('activitylog_watcher.py'),
+guimgr.recent-documents = [loc('__main__.py'),
+                           loc('cad_watcher.py'),
+                           loc('activitylog_watcher.py'),
                            loc('logging_service.py'),
                            loc('cms_watcher.py'),
-                           loc('__main__.py'),
-                           loc('cad_watcher.py'),
                            loc('../../../config/logging_service.cfg')]
 guimgr.visual-state = {loc('get_app_properties.py'): {'attrib-starts': [],
Index: trunk/src/tmcsim/application.properties
===================================================================
--- trunk/src/tmcsim/application.properties	(revision 463)
+++ trunk/src/tmcsim/application.properties	(revision 465)
@@ -1,5 +1,5 @@
-#Tue, 23 Jul 2019 14:36:26 -0700
+#Fri, 26 Jul 2019 06:34:33 -0700
 
-Application.revision=462
+Application.revision=464
 
 Application.buildnumber=170
Index: trunk/src/tmcsim/cadsimulator/Coordinator.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 448)
+++ trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 465)
@@ -8,6 +8,9 @@
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Observer;
 import java.util.TreeMap;
@@ -744,8 +747,33 @@
             Logger.getLogger(Coordinator.class.getName()).log(Level.SEVERE, null, ex);
         }
-        // Initialize an output buffer
-        StringBuffer output = new StringBuffer();
+        // Write output list to a file
+        try 
+        {
+            PrintWriter writer = new PrintWriter(new FileWriter(kCADcommentLog));
+            // process the list of comments obtained from helper method
+            for (String item: getSortedComments(incList))
+            {
+                writer.print(item.substring(9));
+            }
+            writer.close();
+        } catch (Exception exc) 
+        {
+            exc.printStackTrace();
+        } 
+    }
+    
+    /** Extract a list of comments from the current incidents, ordered
+     * by timestamp.  Fixes defect #175.
+     * Package private to allow unit testing.
+     * 
+     * @param incidentList the incidents from which comments are desired
+     * @return list of comments, ready to be output.
+     */
+    List<String> getSortedComments(Vector<Incident> incidentList)
+    {
+        // Initialize a list of for outputing CAD comments
+        ArrayList<String> commentList = new ArrayList<String>();
         // Process all the incidents
-        for (Incident incident: incList)
+        for (Incident incident: incidentList)
         {
             // Retrieve the table of comments/notes the users created
@@ -755,28 +783,38 @@
             {
                 // Combine the fields into one output entry
+                String timestamp = (String)notesTable.getValueAt(row,1);
                 String initials = (String) notesTable.getValueAt(row,2); // user initials
                 // If there are user intials, include this item.
                 // Zero length initials mean it's a scripted item, ignore it.
+                StringBuffer output = new StringBuffer();
                 if (initials.length() > 0)
-                {//CAD Log Entry, Incident #187, Sharon: REQUEST EXTRA ANCHOVIES
-                    output.append("CAD log, ");
+                {//17:03:19 CAD Log Entry, Incident #187, Sharon: REQUEST EXTRA ANCHOVIES
+                    output.append(timestamp);
+                    output.append(" CAD log, ");
                     output.append("Incident #" + incident.logNum + ", ");
                     output.append(initials + ": ");
                     output.append(notesTable.getValueAt(row,4) + "\n"); // notes
+                    commentList.add(output.toString()); // Add this comment to the list
                 }
             }
         }
-        // Write output buffer to a file
-        try 
-        {
-            PrintWriter writer = new PrintWriter(new FileWriter(kCADcommentLog));
-            writer.print(output);
-            writer.close();
-        } catch (Exception exc) 
-        {
-            exc.printStackTrace();
-        } 
-    }
-    
+        // Order the comments by timestamp instead of incident number.
+        Collections.sort(commentList, new java.util.Comparator<String>() 
+        {
+            // provide a comparator that can compare number strings
+            public int compare(String o1, String o2) 
+            {
+                return extractInt(o1) - extractInt(o2);
+            }
+            // extract an integer from a String    
+            int extractInt(String s) 
+            {   // 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);
+            }
+        });
+        return commentList;
+    }
     /** Write the currentSimTime to a file. 
        This will be read asynchronously by web clients, e.g.,
