From 612cd2161aa1a145cc11f559b135a948f972f344 Mon Sep 17 00:00:00 2001 From: JamesP Date: Thu, 10 Sep 2015 17:29:52 +1000 Subject: [PATCH] add examples block to top of times module --- lib/pure/times.nim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 ## `_. +## +## 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!