Software Overview  |  Sitemap  |  Downloads  |  Developers  |  Forums
Small_clear_logo_llc

Interval Timer

The Interval Timer Device acts like one of those plugin wall timers ones buys at the hardware store. One programs it to turn on during certain hours, and it turns on a terminal during those times. Unlike a real timer, this timer has no limit on the number of intervals it can handle, and it can optionally turn on only certain days of the month. Also, the Interval Timer is a Virtual Device, so one can create as many as one needs.

  • Note: for the Interval Timer to work properly, the date and time must be initialized on the host computer.

Time Intervals

The Interval Timer Device has a single output terminal, "out" which it turns on for user definable intervals. Intervals are double quoted strings like "5:00 to 12:30", for the interval from 5AM to 12:30PM. All intervals are expressed in 0-24 hour military time, and separator between the hours is the word "to"; the separator between the hours and minutes should be a colon, ":". If more than one interval is desired, add it to the double quoted string, separated by a comma.

The following are all valid intervals:

  • "9:14 to 17:00" - 9:14AM to 5PM
  • "23:30 to 8:10" - 11:30PM to 8:10AM (of the following day)
  • "00:00 to 24:00" - all day
  • "" - all day
  • "11:00 to 24:00" - 11:00AM until midnight

Hours should generally be from 0-23, but 24:00 can be used to express the end of a day. If an interval goes to a lesser value ("11:00 to 2:00"), the Interval Timer will assume that the second time refers to a time during the next day.

To express more than one interval, add another interval to the string, separated by a comma.

  • "9:30 to 17:10, 23:30 to 24:00" - 9:30AM to 7:10PM and 11:30PM to midnight

Add as many intervals as needed this way. However, intervals should not overlap:

  • "9:10 to 16:23, 12:10 to 20:00" - invalid intervals, they overlap

Time Intervals with a Day of the Month

One can qualify intervals by adding days of the month. Instead of having an interval be for any day, it can be for the 1st, 8th, and 23rd days of the month. Days are expressed as a comma separated string of numbers.

The following are valid days of the month strings:

  • "1" - the first of the month
  • "1,2,3" - the first, 2nd, and 3rd days of the month
  • "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31" - odd days of the month

It is OK to specify days which never happen in some months (31st, as an example). The Interval timer will do the right thing (which is nothing).

Time Intervals with a Day of the Week

One can qualify intervals by adding days of the week. Instead of having an interval be for any day, it can be for the 1st, 3rd and 4th days of the week. Monday is day 1, and Sunday is day 7. Days of the week are expressed as a comma separated string of numbers.

The following are valid days of the week strings:

  • "1" - Monday
  • "1,2,3" - Monday, Tuesday, Wednesday
  • "6,7" - Saturday, Sunday

Using Days of the Month and Days of the Week Together

If one uses days of the week and days of the month together in the same interval, the interval will only occur when both are true. So, for example, if one specified an interval that was on days 1-5 of the month and a week day of Wednesday, the interval would occur when there was a Wednesday and the date of the month was either 1,2,3,4, or 5 (which might not happen at all during some months).

Creating an Interval Timer

Interval Timers are created by running the TimerInterval Script. The Interval Timer has one output terminal, "out" which is on during an interval, and off outside of any intervals. The TimerInterval Script takes three optional parameters: "intervals", "days", and "weekdays".

  • intervals : a double quoted string with one or more intervals, separated by commas. If this string is empty, the "intervals" will be valid during all times of the day.
  • days : a double quoted string with one or more days of the month, separated by commas. If this string is empty, the "intervals" will be valid during all days of the month.
  • weekdays : a double quoted string with one or more days of the week, separated by commas. Monday is day 1, and Sunday is day 7. If this string is empty, the "intervals" will be valid during all days of the week.

Running the TimerInterval Script with the parameters listed below will create an Interval Timer which turns on from 9AM to 12PM and from 11PM to 8:30AM the next day, on the first Wednesday of each month:

id: "my_timer"
intervals: "9:00 to 12:00, 23:00 to 8:30"
days:"1,2,3,4,5,6,7"
weekdays:"3"

Catalina Computing, LLC.

Copyright © Catalina Computing, LLC. (2013-2018)




Page last updated: Wed Jan 7 16:07:02 2015 (UTC)