Bring back Duration construction extensions KT-46229
Return the extension properties for constructing Duration from numbers, but this time place them in Duration.Companion rather than on top-level. - provide the new set of construction extension properties in companion of Duration - leave top-level extension properties experimental, increase their deprecation level to ERROR, propose the extension properties in companion instead. - leave Duration companion static factory functions experimental, deprecate them and propose the extension properties in companion instead.
This commit is contained in:
@@ -37,7 +37,7 @@ internal class HrTimeSource(val process: Process) : TimeSource {
|
||||
override fun markNow(): TimeMark = object : TimeMark() {
|
||||
val startedAt = process.hrtime()
|
||||
override fun elapsedNow(): Duration =
|
||||
process.hrtime(startedAt).let { (seconds, nanos) -> Duration.seconds(seconds) + Duration.nanoseconds(nanos) }
|
||||
process.hrtime(startedAt).let { (seconds, nanos) -> seconds.toDuration(DurationUnit.SECONDS) + nanos.toDuration(DurationUnit.NANOSECONDS) }
|
||||
}
|
||||
|
||||
override fun toString(): String = "TimeSource(process.hrtime())"
|
||||
|
||||
Reference in New Issue
Block a user