Skip to content

Commit

Permalink
Move time to start of day when calculating week for periodic messages
Browse files Browse the repository at this point in the history
  • Loading branch information
randomnetcat committed Dec 27, 2023
1 parent a46935b commit f10cf87
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import java.time.Instant
import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.time.temporal.ChronoField
import java.time.temporal.ChronoUnit
import java.util.concurrent.atomic.AtomicReference
import kotlin.io.path.readText
import kotlin.time.Duration.Companion.seconds
Expand Down Expand Up @@ -137,6 +138,7 @@ private fun randomNextInterval(baseTime: Instant, interval: PeriodicMessageInter
.ofInstant(baseTime, ZoneOffset.UTC)
.plusWeeks(1)
.with(ChronoField.DAY_OF_WEEK, 1)
.truncatedTo(ChronoUnit.DAYS)

val startOfWeekAfterNext = startOfNextWeek.plusWeeks(1)

Expand Down

0 comments on commit f10cf87

Please sign in to comment.