diff --git a/akka-docs/common/index.rst b/akka-docs/common/index.rst index 6ed8cb1593..f3ed26aa73 100644 --- a/akka-docs/common/index.rst +++ b/akka-docs/common/index.rst @@ -5,3 +5,4 @@ Common utilities :maxdepth: 2 scheduler + duration diff --git a/akka-docs/general/index.rst b/akka-docs/general/index.rst index d5288e2af3..4cd57b37b7 100644 --- a/akka-docs/general/index.rst +++ b/akka-docs/general/index.rst @@ -10,5 +10,4 @@ General configuration event-handler issue-tracking - util licenses diff --git a/akka-docs/general/util.rst b/akka-docs/general/util.rst deleted file mode 100644 index bb0f61e778..0000000000 --- a/akka-docs/general/util.rst +++ /dev/null @@ -1,49 +0,0 @@ -######### -Utilities -######### - -.. sidebar:: Contents - - .. contents:: :local: - -This section of the manual describes miscellaneous utilities which are provided -by Akka and used in multiple places. - -.. _Duration: - -Duration -======== - -Durations are used throughout the Akka library, wherefore this concept is -represented by a special data type, :class:`Duration`. Values of this type may -represent infinite (:obj:`Duration.Inf`, :obj:`Duration.MinusInf`) or finite -durations, where the latter are constructable using a mini-DSL: - -.. code-block:: scala - - import akka.util.duration._ // notice the small d - - val fivesec = 5.seconds - val threemillis = 3.millis - val diff = fivesec - threemillis - assert (diff < fivesec) - -.. note:: - - You may leave out the dot if the expression is clearly delimited (e.g. - within parentheses or in an argument list), but it is recommended to use it - if the time unit is the last token on a line, otherwise semi-colon inference - might go wrong, depending on what starts the next line. - -Java provides less syntactic sugar, so you have to spell out the operations as -method calls instead: - -.. code-block:: java - - final Duration fivesec = Duration.create(5, "seconds"); - final Duration threemillis = Duration.parse("3 millis"); - final Duration diff = fivesec.minus(threemillis); - assert (diff.lt(fivesec)); - assert (Duration.Zero().lt(Duration.Inf())); - -