diff --git a/php/classes/TimeTableCacheSortObject.php b/php/classes/TimeTableCacheSortObject.php
index 03e34a2..1071b0c 100644
--- a/php/classes/TimeTableCacheSortObject.php
+++ b/php/classes/TimeTableCacheSortObject.php
@@ -235,7 +235,7 @@ class TimeTableCacheSortObject
 			{
 				$res = $part->compare($global_intervals[$index_a], $global_intervals[$index_b]);
 				if ($res != 0)
-					return $res;
+					return ($res > 0) ? 1 : -1;
 			}
 			return $index_a-$index_b;
 		});
--
libgit2 0.21.2