move code snippets into compiled files for duration.rst, see #2462
This commit is contained in:
parent
4d112f0467
commit
795381787b
3 changed files with 63 additions and 28 deletions
24
akka-docs/common/code/docs/duration/Sample.scala
Normal file
24
akka-docs/common/code/docs/duration/Sample.scala
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue