wait_till: Planned sleep times

Description Usage Arguments Details Examples

View source: R/utils_export.R

Description

Pause the execution of a script either until a certain time is reached, or until a specified amount of time has passed.

Usage

1
wait_till(from = NULL, resume = NULL, seconds = NULL)

Arguments

from

A datetime object, when the beginning of the sleep interval.

resume

A datetime object, representing when the script shall resume.

seconds

An integer, representing the amount of seconds to wait.

Details

Takes either resume OR a combination of from and seconds.

Examples

1
2
3
4
5
6
7
8
9
# Continue script after 20:30:34 on November 14th 2020

continue_at <- lubridate::as_datetime("2020-11-14 20:30:34")
wait_till(resume = continue_at, seconds = 12)

# Continue script 12 seconds after the last call was made

last_timestamp <- lubridate::now()
wait_till(from = last_timestamp, seconds = 12)

schliebs/parleR documentation built on March 28, 2021, 7:34 p.m.