rewrite mechanism of calculating of near time

This commit is contained in:
2021-05-30 17:15:32 +06:00
parent 22ef00fe8f
commit 28f84d4e3a
12 changed files with 371 additions and 139 deletions

View File

@@ -10,7 +10,8 @@ class TimeZoneTest {
@Test
fun testDifferentTimeZonesReturnsDifferentTimes() {
val scheduler = buildSchedule { seconds { every(1) } }
val baseDate = DateTime.now().startOfWeek
val additionalMilliseconds = 100.milliseconds
val baseDate = DateTime.now().startOfWeek.copy(milliseconds = additionalMilliseconds.millisecondsInt)
runTest {
for (i in 0 until 7) {
val now = baseDate + i.days
@@ -18,10 +19,10 @@ class TimeZoneTest {
val nowTz = now.toOffset(j.hours)
val next = scheduler.next(nowTz)!!
assertEquals(
(nowTz + 1.seconds).utc.unixMillisLong, next.utc.unixMillisLong
(nowTz + 1.seconds - additionalMilliseconds).utc.unixMillisLong, next.utc.unixMillisLong
)
}
}
}
}
}
}