JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

os/clock

core-api


    cfunction
    src/core/os.c on line 1581, column 1

    (os/clock &opt source format)

    Return the current time of the requested clock source.

    The `source` argument selects the clock source to use, when not 
    specified the default is `:realtime`:

    * :realtime: Return the real (i.e., wall-clock) time. This clock is 
      affected by discontinuous jumps in the system time
    * :monotonic: Return the number of whole + fractional seconds since 
      some fixed point in time. The clock is guaranteed to be 
      non-decreasing in real time.
    * :cputime: Return the CPU time consumed by this process (i.e. all 
      threads in the process)

    The `format` argument selects the type of output, when not 
    specified the default is `:double`:

    * :double: Return the number of seconds + fractional seconds as a 
      double
    * :int: Return the number of seconds as an integer
    * :tuple: Return a 2 integer tuple [seconds, nanoseconds]


2 examplesSign in to add an example
Loading...
(string/format "%f" (os/clock)) # => "1627746483.991000"
dbreadyPlayground
(os/clock)  # => 1.59384e+09
cellularmitosisPlayground