add examples block to top of times module

This commit is contained in:
JamesP 2015-09-10 17:29:52 +10:00
commit 612cd2161a

View file

@ -11,6 +11,25 @@
## This module contains routines and types for dealing with time. ## This module contains routines and types for dealing with time.
## This module is available for the `JavaScript target ## This module is available for the `JavaScript target
## <backends.html#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 {.push debugger:off.} # the user does not want to trace a part
# of the standard library! # of the standard library!