Implement DurationUnit in JS, add doc summary and conversion test
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:kotlin.jvm.JvmMultifileClass()
|
||||
@@ -9,6 +9,11 @@
|
||||
package kotlin.time
|
||||
|
||||
|
||||
/**
|
||||
* The list of possible time measurement units, in which a duration can be expressed.
|
||||
*
|
||||
* The smallest time unit is [NANOSECONDS] and the largest is [DAYS], which corresponds to exactly 24 [HOURS].
|
||||
*/
|
||||
public expect enum class DurationUnit {
|
||||
/**
|
||||
* Time unit representing one nanosecond, which is 1/1000 of a microsecond.
|
||||
@@ -35,12 +40,12 @@ public expect enum class DurationUnit {
|
||||
*/
|
||||
HOURS,
|
||||
/**
|
||||
* Time unit representing one day, which always equals 24 hours.
|
||||
* Time unit representing one day, which is always equal to 24 hours.
|
||||
*/
|
||||
DAYS;
|
||||
}
|
||||
|
||||
|
||||
/** Converts the given time duration [value] expressed in the specified [sourceUnit] into the specified [targetUnit]. */
|
||||
public expect fun convertDurationUnit(value: Double, sourceUnit: DurationUnit, targetUnit: DurationUnit): Double
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user