Timer » History » Version 1
Per Amundsen, 02/15/2014 04:17 AM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | */timers [off]* |
||
4 | */timer[n|name] [off]* |
||
5 | */timer[n|name] [-cdehimopr] [time] <repetitions> <interval> <code>* |
||
6 | |||
7 | *Switches* |
||
8 | |||
9 | -c - TODO |
||
10 | -d - TODO |
||
11 | -e - Executes the code associated with a timer. |
||
12 | -h - Creates a high-resolution timer. |
||
13 | -i - Dynamically associates itself with the active connection. |
||
14 | -m - Treats the interval parameter as milliseconds instead of seconds. |
||
15 | -o - Creates a offline timer. |
||
16 | -p - Pauses a timer. |
||
17 | -r - Resumes a timer. |
||
18 | |||
19 | *Parameters* |
||
20 | |||
21 | [off] - Turns of a timer. |
||
22 | [n|name] - The name or index of the timer. |
||
23 | [time] - TODO |
||
24 | <repetitions> - The amount of timer the timers should repeat itself. An repetition value of '0' will repeat for ever. |
||
25 | <interval> - The delay between two consecutive timer executions |
||
26 | <code> - Code to be executed. |
||
27 | |||
28 | *Example* |
||
29 | |||
30 | <pre> |
||
31 | alias example { |
||
32 | ;Create a variable and set value to 5. |
||
33 | /var %reps = 5 |
||
34 | |||
35 | ;Call the timer %reps times after 1 second delay each. |
||
36 | /.timer %reps 1 count-down |
||
37 | |||
38 | ;Print the first count. |
||
39 | count-down |
||
40 | } |
||
41 | alias -l count-down { |
||
42 | echo -a Count: $timer($ltimer).reps |
||
43 | } |
||
44 | </pre> |