/usr/share/doc/allegro5-doc/refman/timer.html is in allegro5-doc 2:5.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title>Timer routines</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>
<link rel="stylesheet" href="pandoc.css" type="text/css" />
<script type="text/javascript" src="autosuggest.js"></script>
<script type="text/javascript" src="search_index.js"></script>
</head>
<body>
<div class="sidebar">
<div>
<ul>
<li><a href="index.html"><strong>Contents</strong></a></li>
<li><a href="config.html">Configuration files</a></li>
<li><a href="display.html">Display</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="file.html">File I/O</a></li>
<li><a href="fshook.html">Filesystem</a></li>
<li><a href="fixed.html">Fixed point math</a></li>
<li><a href="fullscreen_mode.html">Fullscreen modes</a></li>
<li><a href="graphics.html">Graphics</a></li>
<li><a href="haptic.html">Haptic</a></li>
<li><a href="joystick.html">Joystick</a></li>
<li><a href="keyboard.html">Keyboard</a></li>
<li><a href="memory.html">Memory</a></li>
<li><a href="monitor.html">Monitor</a></li>
<li><a href="mouse.html">Mouse</a></li>
<li><a href="path.html">Path</a></li>
<li><a href="shader.html">Shader</a></li>
<li><a href="state.html">State</a></li>
<li><a href="system.html">System</a></li>
<li><a href="threads.html">Threads</a></li>
<li><a href="time.html">Time</a></li>
<li><a href="timer.html">Timer</a></li>
<li><a href="touch.html">Touch input</a></li>
<li><a href="transformations.html">Transformations</a></li>
<li><a href="utf8.html">UTF-8</a></li>
<li><a href="misc.html">Miscellaneous</a></li>
<li><a href="platform.html">Platform-specific</a></li>
<li><a href="direct3d.html">Direct3D</a></li>
<li><a href="opengl.html">OpenGL</a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>
<div>
<ul>
<li><a href="index.html#addons"><strong>Addons</strong></a></li>
<li><a href="audio.html">Audio addon</a></li>
<li><a href="acodec.html">Audio codecs</a></li>
<li><a href="color.html">Color addon</a></li>
<li><a href="font.html">Font addons</a></li>
<li><a href="image.html">Image I/O addon</a></li>
<li><a href="main.html">Main addon</a></li>
<li><a href="memfile.html">Memfile addon</a></li>
<li><a href="native_dialog.html">Native dialogs addon</a></li>
<li><a href="physfs.html">PhysicsFS addon</a></li>
<li><a href="primitives.html">Primitives addon</a></li>
<li><a href="video.html">Video streaming addon</a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>
<div>
<ul>
<li><a href="index_all.html"><strong>Index</strong></a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>
<div class="searchbox">
<script type="text/javascript">
function on_search(index, control) {
// Note to self: the less-than sign must NOT converted to an entity!
// SCRIPT elements are special. The HTML validator gives bad advice.
for (i = 0; i < search_index.length; i++) {
if (search_index[i] == control.keywords[index]) {
break;
}
}
location.href = search_urls[i];
}
</script>
Search<br/> <input type="text" name="q" id="q" size="15" autocomplete="off"/><br/>
<script type="text/javascript"> new autosuggest("q", search_index, null, on_search); </script>
</div>
</div>
<div class="content">
<div id="header">
<h1 class="title">Timer routines</h1>
</div>
<div id="TOC">
<ul>
<li><a href="#allegro_timer">ALLEGRO_TIMER</a></li>
<li><a href="#allegro_usecs_to_secs">ALLEGRO_USECS_TO_SECS</a></li>
<li><a href="#allegro_msecs_to_secs">ALLEGRO_MSECS_TO_SECS</a></li>
<li><a href="#allegro_bps_to_secs">ALLEGRO_BPS_TO_SECS</a></li>
<li><a href="#allegro_bpm_to_secs">ALLEGRO_BPM_TO_SECS</a></li>
<li><a href="#al_create_timer">al_create_timer</a></li>
<li><a href="#al_start_timer">al_start_timer</a></li>
<li><a href="#al_resume_timer">al_resume_timer</a></li>
<li><a href="#al_stop_timer">al_stop_timer</a></li>
<li><a href="#al_get_timer_started">al_get_timer_started</a></li>
<li><a href="#al_destroy_timer">al_destroy_timer</a></li>
<li><a href="#al_get_timer_count">al_get_timer_count</a></li>
<li><a href="#al_set_timer_count">al_set_timer_count</a></li>
<li><a href="#al_add_timer_count">al_add_timer_count</a></li>
<li><a href="#al_get_timer_speed">al_get_timer_speed</a></li>
<li><a href="#al_set_timer_speed">al_set_timer_speed</a></li>
<li><a href="#al_get_timer_event_source">al_get_timer_event_source</a></li>
</ul>
</div>
<p>These functions are declared in the main Allegro header file:</p>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"> <span class="pp">#include </span><span class="im"><allegro5/allegro.h></span></code></pre></div>
<h1 id="allegro_timer">ALLEGRO_TIMER</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="kw">typedef</span> <span class="kw">struct</span> ALLEGRO_TIMER ALLEGRO_TIMER;</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/include/allegro5/timer.h#L46">Source Code</a></p>
<p>This is an abstract data type representing a timer object.</p>
<h1 id="allegro_usecs_to_secs">ALLEGRO_USECS_TO_SECS</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="pp">#define ALLEGRO_USECS_TO_SECS(x) ((x) / 1000000.0)</span></code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/include/allegro5/timer.h#L29">Source Code</a></p>
<p>Convert microseconds to seconds.</p>
<h1 id="allegro_msecs_to_secs">ALLEGRO_MSECS_TO_SECS</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="pp">#define ALLEGRO_MSECS_TO_SECS(x) ((x) / 1000.0)</span></code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/include/allegro5/timer.h#L33">Source Code</a></p>
<p>Convert milliseconds to seconds.</p>
<h1 id="allegro_bps_to_secs">ALLEGRO_BPS_TO_SECS</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="pp">#define ALLEGRO_BPS_TO_SECS(x) (1.0 / (x))</span></code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/include/allegro5/timer.h#L37">Source Code</a></p>
<p>Convert beats per second to seconds.</p>
<h1 id="allegro_bpm_to_secs">ALLEGRO_BPM_TO_SECS</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="pp">#define ALLEGRO_BPM_TO_SECS(x) (60.0 / (x))</span></code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/include/allegro5/timer.h#L41">Source Code</a></p>
<p>Convert beats per minute to seconds.</p>
<h1 id="al_create_timer">al_create_timer</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">ALLEGRO_TIMER *al_create_timer(<span class="dt">double</span> speed_secs)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L244">Source Code</a></p>
<p>Allocates and initializes a timer. If successful, a pointer to a new timer object is returned, otherwise NULL is returned. <em>speed_secs</em> is in seconds per "tick", and must be positive. The new timer is initially stopped.</p>
<p>Usage note: typical granularity is on the order of microseconds, but with some drivers might only be milliseconds.</p>
<p>See also: <a href="timer.html#al_start_timer">al_start_timer</a>, <a href="timer.html#al_destroy_timer">al_destroy_timer</a></p>
<h1 id="al_start_timer">al_start_timer</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_start_timer(ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L287">Source Code</a></p>
<p>Start the timer specified. From then, the timer's counter will increment at a constant rate, and it will begin generating events. Starting a timer that is already started does nothing. Starting a timer that was stopped will reset the timer's counter, effectively restarting the timer from the beginning.</p>
<p>See also: <a href="timer.html#al_stop_timer">al_stop_timer</a>, <a href="timer.html#al_get_timer_started">al_get_timer_started</a>, <a href="timer.html#al_resume_timer">al_resume_timer</a></p>
<h1 id="al_resume_timer">al_resume_timer</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_resume_timer(ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L296">Source Code</a></p>
<p>Resume the timer specified. From then, the timer's counter will increment at a constant rate, and it will begin generating events. Resuming a timer that is already started does nothing. Resuming a stopped timer will not reset the timer's counter (unlike al_start_timer).</p>
<p>See also: <a href="timer.html#al_start_timer">al_start_timer</a>, <a href="timer.html#al_stop_timer">al_stop_timer</a>, <a href="timer.html#al_get_timer_started">al_get_timer_started</a></p>
<h1 id="al_stop_timer">al_stop_timer</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_stop_timer(ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L305">Source Code</a></p>
<p>Stop the timer specified. The timer's counter will stop incrementing and it will stop generating events. Stopping a timer that is already stopped does nothing.</p>
<p>See also: <a href="timer.html#al_start_timer">al_start_timer</a>, <a href="timer.html#al_get_timer_started">al_get_timer_started</a>, <a href="timer.html#al_resume_timer">al_resume_timer</a></p>
<h1 id="al_get_timer_started">al_get_timer_started</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">bool al_get_timer_started(<span class="dt">const</span> ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L325">Source Code</a></p>
<p>Return true if the timer specified is currently started.</p>
<h1 id="al_destroy_timer">al_destroy_timer</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_destroy_timer(ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L271">Source Code</a></p>
<p>Uninstall the timer specified. If the timer is started, it will automatically be stopped before uninstallation. It will also automatically unregister the timer with any event queues.</p>
<p>Does nothing if passed the NULL pointer.</p>
<p>See also: <a href="timer.html#al_create_timer">al_create_timer</a></p>
<h1 id="al_get_timer_count">al_get_timer_count</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">int64_t</span> al_get_timer_count(<span class="dt">const</span> ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L368">Source Code</a></p>
<p>Return the timer's counter value. The timer can be started or stopped.</p>
<p>See also: <a href="timer.html#al_set_timer_count">al_set_timer_count</a></p>
<h1 id="al_set_timer_count">al_set_timer_count</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_set_timer_count(ALLEGRO_TIMER *timer, <span class="dt">int64_t</span> new_count)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L379">Source Code</a></p>
<p>Set the timer's counter value. The timer can be started or stopped. The count value may be positive or negative, but will always be incremented by +1 at each tick.</p>
<p>See also: <a href="timer.html#al_get_timer_count">al_get_timer_count</a>, <a href="timer.html#al_add_timer_count">al_add_timer_count</a></p>
<h1 id="al_add_timer_count">al_add_timer_count</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_add_timer_count(ALLEGRO_TIMER *timer, <span class="dt">int64_t</span> diff)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L394">Source Code</a></p>
<p>Add <em>diff</em> to the timer's counter value. This is similar to writing:</p>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">al_set_timer_count(timer, al_get_timer_count(timer) + diff);</code></pre></div>
<p>except that the addition is performed atomically, so no ticks will be lost.</p>
<p>See also: <a href="timer.html#al_set_timer_count">al_set_timer_count</a></p>
<h1 id="al_get_timer_speed">al_get_timer_speed</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">double</span> al_get_timer_speed(<span class="dt">const</span> ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L336">Source Code</a></p>
<p>Return the timer's speed, in seconds. (The same value passed to <a href="timer.html#al_create_timer">al_create_timer</a> or <a href="timer.html#al_set_timer_speed">al_set_timer_speed</a>.)</p>
<p>See also: <a href="timer.html#al_set_timer_speed">al_set_timer_speed</a></p>
<h1 id="al_set_timer_speed">al_set_timer_speed</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">void</span> al_set_timer_speed(ALLEGRO_TIMER *timer, <span class="dt">double</span> new_speed_secs)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L347">Source Code</a></p>
<p>Set the timer's speed, i.e. the rate at which its counter will be incremented when it is started. This can be done when the timer is started or stopped. If the timer is currently running, it is made to look as though the speed change occurred precisely at the last tick.</p>
<p><em>speed_secs</em> has exactly the same meaning as with <a href="timer.html#al_create_timer">al_create_timer</a>.</p>
<p>See also: <a href="timer.html#al_get_timer_speed">al_get_timer_speed</a></p>
<h1 id="al_get_timer_event_source">al_get_timer_event_source</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c">ALLEGRO_EVENT_SOURCE *al_get_timer_event_source(ALLEGRO_TIMER *timer)</code></pre></div>
<p><a href="https://github.com/liballeg/allegro5/blob/master/src/timernu.c#L436">Source Code</a></p>
<p>Retrieve the associated event source. Timers will generate events of type <a href="events.html#allegro_event_timer">ALLEGRO_EVENT_TIMER</a>.</p>
<p class="timestamp">
Allegro version 5.2.2
- Last updated: 2017-01-02 15:17:36 UTC
</p>
</div>
</body>
</html>
|