move code snippets into compiled files for duration.rst, see #2462

This commit is contained in:
Roland 2012-09-13 11:16:01 +02:00
parent 4d112f0467
commit 795381787b
3 changed files with 63 additions and 28 deletions

View file

@ -0,0 +1,24 @@
/**
* Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com>
*/
package docs.duration
object Scala {
//#dsl
import scala.concurrent.util.duration._ // notice the small d
val fivesec = 5.seconds
val threemillis = 3.millis
val diff = fivesec - threemillis
assert(diff < fivesec)
val fourmillis = threemillis * 4 / 3 // though you cannot write it the other way around
val n = threemillis / (1 millisecond)
//#dsl
//#deadline
val deadline = 10.seconds.fromNow
// do something
val rest = deadline.timeLeft
//#deadline
}