NAME
CurrentTimeOfDayIsAbout — Check if current time is within an interval around target.
SYNOPSIS
CurrentTimeOfDayIsAbout TargetTimeOfDay WithinInterval ?Option?
DESCRIPTION
Return Value
1 Current time-of-day is within interval around target.
0 Current time-of-day is outside of interval around target.
Arguments
TargetTimeOfDayTime of day to check current time against.
WithinIntervalHow much time to add/subtract from the target time to form a range that the current time must go in in order for this to return true. See More Info and Examples for format.
OptionWhether to count a time-of-day that happens at the very beginning or end as being between. Defaults to BothExclusive (see More Info).
More Info
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.

This command will take a target time-of-day, and some interval before and after it, it will then see if the current time-of-day is within that range around the target. If so, it will return 1, and, if not, then it will return 0.

You might use this command, for example, with a timer that goes off and has to check what time it is and then do something based on how close it is to some appointed time.

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
% # Suppose it is now 12:00 PM
% CurrentTimeOfDayIsAbout "12:30:00" "1H 0M 0S"
1
% CurrentTimeOfDayIsAbout "12:30:00" "0H 5M 0S"
0
% CurrentTimeOfDayIsAbout "13:00:00" "1H 0M 0S" RightInclusive
0
% CurrentTimeOfDayIsAbout "13:00:00" "1H 0M 0S" LeftInclusive
1
SEE ALSO
CurrentTimeOfDayIsAfter, CurrentTimeOfDayIsBefore, CurrentTimeOfDayIsBetween, TimeOfDayIsAbout
KEYWORDS
check, clock, time