Index: /trunk/autoquest-ui-core/src/main/java/de/ugoe/cs/autoquest/commands/sequences/CMDcheckEventTimestamps.java
===================================================================
--- /trunk/autoquest-ui-core/src/main/java/de/ugoe/cs/autoquest/commands/sequences/CMDcheckEventTimestamps.java	(revision 2286)
+++ /trunk/autoquest-ui-core/src/main/java/de/ugoe/cs/autoquest/commands/sequences/CMDcheckEventTimestamps.java	(revision 2287)
@@ -18,4 +18,5 @@
 import java.util.LinkedList;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.logging.Level;
 
@@ -84,4 +85,7 @@
             Console.println("sequences with timestamp issues listed");
         }
+        else if ("sort".equals(command)) {
+            sortEventsUsingTimestamps(sequences, newSequencesName);
+        }
         else if ("delete".equals(command)) {
             deleteSequencesWithInvalidTimestamps(sequences, newSequencesName);
@@ -156,4 +160,53 @@
                 }
             }
+        }
+    }
+
+    /**
+     * <p>
+     * sorts events in sequences with invalid timestamps from the provided collection of sequences and
+     * stores them under new name
+     * </p>
+     *
+     * @param sequences        the collection of sequences to sort the events in
+     * @param newSequencesName the name for the new corrected collection of sequences
+     */
+    private void sortEventsUsingTimestamps(Collection<List<Event>> sequences,
+                                           String                  newSequencesName)
+    {
+        Collection<List<Event>> newSequences = new LinkedList<List<Event>>();
+        
+        for (List<Event> sequence : sequences) {
+            
+            List<Event> newSequence = new LinkedList<>();
+            
+            for (Event currentEvent : sequence) {
+                boolean added = false;
+                
+                ListIterator<Event> iterator = newSequence.listIterator();
+                
+                while (iterator.hasNext()) {
+                    if (iterator.next().getTimestamp() > currentEvent.getTimestamp()) {
+                        iterator.previous();
+                        iterator.add(currentEvent);
+                        added = true;
+                        break;
+                    };
+                }
+                
+                if (!added) {
+                    newSequence.add(currentEvent);
+                }
+                
+            }
+            
+            newSequences.add(newSequence);
+        }
+        
+        Console.traceln(Level.WARNING, sequences.size() +
+                        " sequences sorted based on event timestamps");
+            
+        if (GlobalDataContainer.getInstance().addData(newSequencesName, newSequences)) {
+            CommandHelpers.dataOverwritten(newSequencesName);
         }
     }
Index: /trunk/autoquest-ui-core/src/main/resources/manuals/checkEventTimestamps
===================================================================
--- /trunk/autoquest-ui-core/src/main/resources/manuals/checkEventTimestamps	(revision 2286)
+++ /trunk/autoquest-ui-core/src/main/resources/manuals/checkEventTimestamps	(revision 2287)
@@ -1,11 +1,12 @@
-checks all sequences of a collection of sequences for correct timestamps and event order. It supports counting the number of invalid sequences, listing details about invalid sequences and timestamps, as well as deleting invalid sequences.
+checks all sequences of a collection of sequences for correct timestamps and event order. It supports counting the number of invalid sequences, listing details about invalid sequences and timestamps, sorting sequences based on the timestamps, as well as deleting invalid sequences.
 
 $USAGE$
-<command> one of "count", "list", and "delete"
+<command> one of "count", "list", "sort" and "delete"
 <sequencesName> the name of the collection of sequences that shall be checked
-<newSequences> optional; the name of the collection of sequences into which the resulting sequences shall be stored in case the delete command is selected; if left out, the result is stored in the collection identified by <sequencesName>
+<newSequences> optional; the name of the collection of sequences into which the resulting sequences shall be stored in case the sort or delete command is selected; if left out, the result is stored in the collection identified by <sequencesName>
 
 Example(s):
 checkEventTimestamps count someSequences
 checkEventTimestamps list someSequences
+checkEventTimestamps sort someSequences someNewSequences
 checkEventTimestamps delete someSequences someNewSequences
