hires_time: Return the current high-resolution real time.

Description Usage Examples

View source: R/hires_time.R

Description

Time is expressed as seconds since some arbitrary time in the past; it is not correlated in any way to the time of day, and thus is not subject to resetting or drifting. The hi-res timer is ideally suited to performance measurement tasks, where cheap, accurate interval timing is required.

Usage

1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
hires_time()

# R rounds doubles to 7 digits by default, see greater precision by setting
# the digits argument when printing
print(hires_time(), digits = 20)

# Generally used by recording two times and then subtracting them
start <- hires_time()
end <- hires_time()
elapsed <- end - start
elapsed

Example output

[1] 1615350768
[1] 1615350768.4176568985
[1] 9.536743e-06

bench documentation built on March 26, 2020, 6:32 p.m.