From 38eaf82c65b979c0b328883e1c4d47fd475e582c Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Fri, 8 Sep 2017 11:00:46 +0100 Subject: [PATCH] Ensure that time is monotonic when running autocompile --- .../public/coffee/ide/pdf/controllers/PdfController.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index d55203c267..897983f47a 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -80,8 +80,11 @@ define [ return if autoCompileTimeout timeSinceLastCompile = Date.now() - $scope.recompiledAt + # If time is non-monotonic, assume that the user's system clock has been + # changed and continue with recompile + isTimeNonMonotonic = timeSinceLastPoll < 0; - if timeSinceLastCompile >= AUTO_COMPILE_TIMEOUT + if isTimeNonMonotonic || timeSinceLastCompile >= AUTO_COMPILE_TIMEOUT if (!ide.$scope.hasLintingError) $scope.recompile(isBackgroundAutoCompile: true) else