diff options
author | JamesP <jlp765@gmail.com> | 2015-09-10 17:29:52 +1000 |
---|---|---|
committer | JamesP <jlp765@gmail.com> | 2015-09-10 17:29:52 +1000 |
commit | 612cd2161aa1a145cc11f559b135a948f972f344 (patch) | |
tree | 33bfe55870b5b9a6844fd29e84f1ecbe4f9ebf6c | |
parent | 0c7d52e34ccf69a1b1d7ab6fb15e36ca53e9864b (diff) | |
download | Nim-612cd2161aa1a145cc11f559b135a948f972f344.tar.gz |
add examples block to top of times module
-rw-r--r-- | lib/pure/times.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index aa4ae5ace..5d960b11a 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -11,6 +11,25 @@ ## This module contains routines and types for dealing with time. ## This module is available for the `JavaScript target ## <backends.html#the-javascript-target>`_. +## +## Examples: +## +## .. code-block:: nim +## +## import times, os +## var +## t = cpuTime() +## +## sleep(100) # replace this with something to be timed +## echo "Time taken: ",cpuTime() - t +## +## echo "My formatted time: ", format(getLocalTime(getTime()), "d MMMM yyyy HH:mm") +## echo "Using predefined formats: ", getClockStr(), " ", getDateStr() +## +## echo "epochTime() float value: ", epochTime() +## echo "getTime() float value: ", toSeconds(getTime()) +## echo "cpuTime() float value: ", cpuTime() +## echo "An hour from now: ", getLocalTime(getTime()) + initInterval(0,0,0,1) {.push debugger:off.} # the user does not want to trace a part # of the standard library! |