summaryrefslogtreecommitdiff
path: root/test/disabled/presentation/akka/src/akka/util/package.scala
blob: 26a24929c9b1787941e26890543fd5582eb2678a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
 */

package akka.util

import java.util.concurrent.TimeUnit

package object duration {
  implicit def intToDurationInt(n: Int) = new DurationInt(n)
  implicit def longToDurationLong(n: Long) = new DurationLong(n)
  implicit def doubleToDurationDouble(d: Double) = new DurationDouble(d)

  implicit def pairIntToDuration(p: (Int, TimeUnit)) = Duration(p._1, p._2)
  implicit def pairLongToDuration(p: (Long, TimeUnit)) = Duration(p._1, p._2)
  implicit def durationToPair(d: Duration) = (d.length, d.unit)

  implicit def intMult(i: Int) = new {
    def *(d: Duration) = d * i
  }
  implicit def longMult(l: Long) = new {
    def *(d: Duration) = d * l
  }
  implicit def doubleMult(f: Double) = new {
    def *(d: Duration) = d * f
  }
}