# The `caldelay` program

This command is obsolete; it is no longer included in the current version.
```caldelay program [arg ...]
```

`caldelay` increases `\$DELAY` as necessary so that the current time plus `\$DELAY` seconds will match the description of a calendar time given by certain environment variables, and then runs the given command. If `\$DELAY` is not set, this is interpreted as an indefinite delay, and `caldelay` leaves it unset. Controlling environment variables include `\$YEAR`, `\$MONTH`, `\$MONTHDAY`, `\$WEEKDAY`, `\$HOUR`, `\$MINUTE`, and `\$SECOND`. All are optional. Each one that is specified is a list of constraints. All calendar times that satisfy at least one constraint for each time unit are considered to be matches. Each constraint must take one of the following forms (otherwise, `caldelay` exits with an error):

• `/n`: matches times when the given unit is divisible by `n`.
• `=n`: matches times when the given unit is exactly `n`.
• `-n`: matches times when the given unit is exactly `m`, where `n+m` is one more than the largest value of the unit. (E.g., `n+m=24` for `\$HOUR`, so `HOUR=-1` is equivalent to `HOUR==23`).

Note that `/0` is equivalent to `=0`, because zero is divisible by itself.

If a variable is not set in the environment, or is set to an empty string, the default depends on which others are set. If any larger unit is set, then the default is `=0`; otherwise, the default is `/1`. For example, if `\$HOUR` is set and no others are, then `\$YEAR`, `\$MONTH`, `\$MONTHDAY`, and `\$WEEKDAY` default to `/1` (i.e., no restrictions), and `\$MINUTE` and `\$SECOND` default to `=0`. Thus `\$DELAY` will be the number of seconds until the next occurrence of the beginning of the given hour.

## Caveats

• All units count from zero; `\$MONTH` and `\$MONTHDAY` differ by one from what you might expect. `WEEKDAY==0` is Sunday, `MONTH==0` is January, and `MONTHDAY==0` is the first of the month.
• Do not use `\$WEEKDAY` together with any of `\$YEAR`, `\$MONTH`, or `\$MONTHDAY`. The results will probably not be what you expect, and may be subject to change in future versions.
• In the current version, all calculations are done in the UTC time zone; libtai does not currently provide the necessary support for other time zones.
{"ft_lang_label":"__label__en","ft_lang_prob":0.80492693,"math_prob":0.9666258,"size":1881,"snap":"2020-34-2020-40","text_gpt3_token_len":533,"char_repetition_ratio":0.11028237,"word_repetition_ratio":0.053097345,"special_character_ratio":0.25093037,"punctuation_ratio":0.15721649,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96590924,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-22T21:33:47Z\",\"WARC-Record-ID\":\"<urn:uuid:d03000a4-2aff-4cc8-97bf-992c622795b1>\",\"Content-Length\":\"3698\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:677e297a-5fc8-411a-a102-638f4b6978b5>\",\"WARC-Concurrent-To\":\"<urn:uuid:8269e791-2f59-4ef7-a81d-71b2fb73c81a>\",\"WARC-IP-Address\":\"66.228.43.15\",\"WARC-Target-URI\":\"https://code.dogmap.org/runwhen/caldelay/\",\"WARC-Payload-Digest\":\"sha1:RR3LF272LS6CX3OHX7HFPF3WNRZXAHN4\",\"WARC-Block-Digest\":\"sha1:PIT6BPRANSXG7ZUSM2TDNI7SUSNCYVKB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400206763.24_warc_CC-MAIN-20200922192512-20200922222512-00296.warc.gz\"}"}