NAME
TimeOfDayIsAbout — Check if target time of day is within an interval.
SYNOPSIS
TimeOfDayIsAbout TargetTimeOfDay IntervalMidpoint IntervalWidth ?Option?
DESCRIPTION
Return Value
1 Target time-of-day is within the given interval.
0 Target time-of-day is outside the given interval.
Arguments
TargetTimeOfDayTime-of-day to check.
IntervalMidpointMidpoint of the interval to check against (see Examples for details).
IntervalWidthWidth of the interval to check against (see Examples for details).
OptionWhether to count a target time-of-day that falls on an endpoint as being within the interval. Defaults to BothInclusive (see More Info).
More Info
This command will take an interval of time (e.g. 11:55 to 12:05), given by a midpoint (e.g. 12:00) and a width (e.g. 0H 5M 0S), and will check if the target time-of-day (e.g. 11:59) is within that range around the target. If so, it will return 1, and, if not, then it will return 0.

Note that the default for this command differs from CurrentTimeOfDayIsAbout. For this command the default is BothInclusive. This means that if you give an interval of 11:55 to 12:05 and the target is 11:55 then it will consider it as falling within the interval. CurrentTimeOfDayIsAbout will be changed in the next major release.

The time-of-day should be formatted according to the configuration (see here for details or SetTimeOfDayFormat). The configuration defaults to %H:%M:%S, which means 12 o'clock is 12:00:00. (And if you are happy with that, you do not have to do anything to make it work, only if you want something different.)

The interval format is {xH yM zS} where x, y, and z are all integers and stand for hours, minutes, and seconds. See examples for usage.

Options are:
1. BothExclusive (Second < First < Third).
2. BothInclusive (Second <= First <= Third).
3. LeftExclusive (Second < First <= Third).
4. LeftInclusive (Second <= First < Third).
5. RightExclusive (Second <= First < Third).
6. RightInclusive (Second < First <= Third).

Left and right are referring to the interval going around the target time, not the current time. So if the target time is 06:00:00 and the interval is an hour, then LeftInclusive includes 05:00:00, and RightInclusive includes 07:00:00. See examples to understand the options.


For information regarding exceptions / errors, see here.
EXAMPLES
% TimeOfDayIsAbout 11:59:00 12:00:00 "0H 5M 0S"
1
% TimeOfDayIsAbout 11:55:00 12:00:00 "0H 5M 0S" BothInclusive
1
% TimeOfDayIsAbout 11:55:00 12:00:00 "0H 5M 0S" BothExclusive
0
SEE ALSO
CurrentTimeOfDayIsAbout, TimeOfDayIsAfter, TimeOfDayIsBefore, TimeOfDayIsBetween
KEYWORDS
check, clock, time