The rw-match program

rw-match stamp constraints [VAR program arg ...]

rw-match computes the earliest time at or after the given timestamp that matches the given constraints. Then, if no variable name and command are given, it prints the result on stdout. Otherwise, it sets the environment variable to contain the result and runs the given command.

The constraints are given as, for example, ",d-3,H=14,M/15" (note the leading comma). This example matches any time where the day of the month is the third from the last day of the month, the hour of the day is 14, and the minutes are divisible by 15 - so, 14:00, 14:15, 14:30, and 14:45, on January 29th, or February 26th (or 27th), etc. These constraints match the time acording to the local time zone.

The constraint string consists of a sequence of unit constraints. Each unit constrint consists of a comma, one of the following letters indicating which unit is constrained:

and finally one of the following:

Caveat

Do not use ,w together with any of ,y, ,m, or ,d. The results will probably not be what you expect, and may be subject to change in future versions.