Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Risk calculation cannot be restarted after time travel (EXPOSUREAPP-6646) #3327

Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ class RiskLevelTask @Inject constructor(

if (!configData.isDeviceTimeCorrect) {
Timber.w("Device time is incorrect, offset: %s", configData.localOffset)
val currentServerTime = nowUTC.minus(configData.localOffset)
Timber.d("Calculated current server time: %s", currentServerTime)
return EwRiskLevelTaskResult(
calculatedAt = nowUTC,
calculatedAt = currentServerTime,
failureReason = FailureReason.INCORRECT_DEVICE_TIME
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ class RiskLevelTaskTest : BaseTest() {
every { configData.isDeviceTimeCorrect } returns false
every { configData.localOffset } returns Duration.standardHours(5)

val serverTime = testTimeNow.minus(configData.localOffset)

createTask().run(arguments) shouldBe EwRiskLevelTaskResult(
calculatedAt = testTimeNow,
calculatedAt = serverTime,
failureReason = EwRiskLevelResult.FailureReason.INCORRECT_DEVICE_TIME
)
}
Expand Down