refactor: Line breaks for time separations linked to TimeFrame (#1502)

This commit is contained in:
Robert-0410 2024-12-23 02:34:22 -08:00 committed by GitHub
parent 45e50b829a
commit 16a8503207
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 5 deletions

View file

@ -147,6 +147,20 @@ enum class TimeFrame(
}
}
/**
* Used to detect a significant time separation between [Telemetry]s.
*/
fun timeThreshold(): Long {
return when (this.ordinal) {
TWENTY_FOUR_HOURS.ordinal ->
TimeUnit.HOURS.toSeconds(6)
FORTY_EIGHT_HOURS.ordinal ->
TimeUnit.HOURS.toSeconds(12)
else ->
TimeUnit.DAYS.toSeconds(1)
}
}
/**
* Calculates the needed [Dp] depending on the amount of time being plotted.
*