Fix infinite loop and cleanup in TimeComparison.c