at

Gamma: Version 4.0
Prev |  | Next

# `at`

`at` -- performs an action at a given time, or regularly.

## Syntax

    at (day, month, year, hour, minute, second, actions...)

## Arguments

`day`

  Restriction on the day of the month (1-31), or nil for none.

`month`

  Restriction on the month of the year (1-12), or nil for none.

`year`

  Restriction on the year (1994-2026), or nil for none.

`hour`

  Restriction on the hour of the day (0-23), or nil for none.

`minute`

  Restriction on the minute in the hour (0-59), or nil for none.

`second`

  Restriction on the second in the minute (0-59), or nil for none.

`actions`

  The actions to perform when the specified time arrives.

## Returns

An integer number which may be used as the argument to `cancel`.

## Description

This function specifies an action to be performed at a given time, or to occur regularly at certain times of the `minute`, `hour`, `day`, `month` or `year`. A restriction on a particular attribute of the time will cause `at` to fire only if that restriction is true.

A restriction may be any number in the legal range of that attribute, or a list of numbers in that range. Illegal values for the time will be normalized. For example, a time specified as July 0, 1994 00:00:00 will be treated as June 30, 1994 00:00:00. If nil is specified for any attribute of the time, this implies no restriction and `at` will fire cyclically at every legal value for that attribute.

For Gamma to notice a timer, you must make a call to `next_event`. To notice repeating timers, the call to `next_event` can be used with a call to `while(t)`.

## Example

        //To print "hello" at 12:00 noon on June 2, 1994:
        at(2,6,1994,12,0,0,#princ("hello\n"));

        //To print "hello" at 12:00 noon on the first day
        //of every month in 1994:
        at(1,nil,1994,12,0,0,#princ("hello\n"));

        //To print "hello" every half minute at 30 seconds
        //and on the minute on the 1st and 15th of every month
        //except July and August, for any year:
        at(list(1,15), list(1,2,3,4,5,6,9,10,11,12),list(0,30), #(princ "hello\n"));

        //To print "hello" every 10 seconds during the hour
        //of 3:00pm every December 21st.
        at(21,12,nil,15,nil,list(0,10,20,30,40,50), #princ("hello\n"));

## See Also

`after`, `every`, `_timers_` in Predefined Symbosl

Prev | Home | Next
`after` | Up | `block_timers`, `unblock_timers`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.