akka.util.JavaDurationConverters.scala Maven / Gradle / Ivy
/*
* Copyright (C) 2009-2019 Lightbend Inc.
*/
package akka.util
import java.time.{ Duration => JDuration }
import scala.concurrent.duration.{ Duration, FiniteDuration }
/**
* INTERNAL API
*/
private[akka] object JavaDurationConverters {
def asFiniteDuration(duration: JDuration): FiniteDuration = duration.asScala
final implicit class JavaDurationOps(val self: JDuration) extends AnyVal {
def asScala: FiniteDuration = Duration.fromNanos(self.toNanos)
}
final implicit class ScalaDurationOps(val self: Duration) extends AnyVal {
def asJava: JDuration = JDuration.ofNanos(self.toNanos)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy