All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.krono.utils.conversions.years.kt Maven / Gradle / Ivy

There is a newer version: 3.0.14
Show newest version
package krono.utils.conversions

import krono.DurationUnit
import kotlin.math.pow

internal fun convertYears(value: Double, into: DurationUnit) = value * when (into) {
    DurationUnit.NanoSeconds -> 355.25 * 60 * 60 * 10.0.pow(9)
    DurationUnit.MicroSeconds -> 355.25 * 60 * 60 * 10.0.pow(6)
    DurationUnit.MilliSeconds -> 355.25 * 60 * 60 * 10.0.pow(3)
    DurationUnit.Seconds -> 355.25 * 60 * 60
    DurationUnit.Minutes -> 355.25 * 60
    DurationUnit.Hours -> 355.25 * 24
    DurationUnit.Days -> 355.25
    DurationUnit.Weeks -> 52.1429
    DurationUnit.Months -> 12.0
    DurationUnit.Years -> 1.0
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy