package com.vgmlr.timber
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
internal object TimberOTCClock {
fun getFileNameTimestamp(now: LocalDateTime = LocalDateTime.now()): String {
val march20 = LocalDate.of(now.year, 3, 20)
val newYear = if (now.toLocalDate().isBefore(march20)) march20.minusYears(1) else march20
val daysSince = ChronoUnit.DAYS.between(newYear, now.toLocalDate()) + 1
val otcYear = "0" + newYear.format(DateTimeFormatter.ofPattern("yy"))
val hhmmss = now.format(DateTimeFormatter.ofPattern("HHmmss"))
return "$otcYear$daysSince$hhmmss"
}
}