timefactory: Create running timer functions

Description Usage Value Examples

Description

This is a factory function for creating running timers. A function created using timefactory() will return the number of seconds since it was first created. It is intended as a simple alternative to wrapping code in multiple calls to proc.time().

Usage

1

Value

A function that will return the number of seconds since it was first created.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create an initial timer
timer1 = timefactory()
Sys.sleep(3)
timer1()

# Create a second timer that is independent of the first.
timer2 = timefactory()
Sys.sleep(2)

timer1()
timer2()

awmercer/timefactory documentation built on May 14, 2019, 6:14 p.m.