diff --git a/delta/testkit/src/main/scala/ch/epfl/bluebrain/nexus/testkit/scalatest/ce/CatsIOValues.scala b/delta/testkit/src/main/scala/ch/epfl/bluebrain/nexus/testkit/scalatest/ce/CatsIOValues.scala index a9f35012bc..d9e2e2ab35 100644 --- a/delta/testkit/src/main/scala/ch/epfl/bluebrain/nexus/testkit/scalatest/ce/CatsIOValues.scala +++ b/delta/testkit/src/main/scala/ch/epfl/bluebrain/nexus/testkit/scalatest/ce/CatsIOValues.scala @@ -14,10 +14,7 @@ trait CatsIOValues { implicit final class CatsIOValuesOps[A](private val io: IO[A]) { def accepted(implicit pos: source.Position): A = { - io.attempt.unsafeRunTimed(45.seconds).getOrElse(fail("IO timed out during .accepted call")) match { - case Left(e) => fail(s"IO failed when it was expected to succeed $e.", e) - case Right(value) => value - } + io.unsafeRunTimed(45.seconds).getOrElse(fail("IO timed out during .accepted call")) } def rejected(implicit pos: source.Position): Throwable = rejectedWith[Throwable] diff --git a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/EventClock.scala b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/EventClock.scala index 27d74b5326..6c039f408b 100644 --- a/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/EventClock.scala +++ b/ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/EventClock.scala @@ -21,7 +21,9 @@ class EventClock(instant: Ref[IO, Instant]) extends Clock[IO] { override def realTime: IO[FiniteDuration] = toDuration private def toDuration: IO[FiniteDuration] = instant.get.map { i => - FiniteDuration(i.toEpochMilli, TimeUnit.MILLISECONDS) + val seconds = FiniteDuration(i.getEpochSecond, TimeUnit.SECONDS) + val nanos = FiniteDuration(i.getNano, TimeUnit.NANOSECONDS) + seconds + nanos } }