MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Timer_Init

Function Timer_Init

src/timer.c:230–264  ·  view source on GitHub ↗

* Initialize the timer. */

Source from the content-addressed store, hash-verified

228 * Initialize the timer.
229 */
230void Timer_Init(void)
231{
232 s_timerLastTime = Timer_GetTime();
233
234#if defined(_WIN32)
235 s_timerTime = s_timerSpeed / 1000;
236 DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &s_timerMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
237#elif defined(TOS)
238 (void)Cconws("Timer_Init()\r\n");
239 /* see http://toshyp.atari.org/en/004009.html#Xbtimer */
240 /* s_timerSpeed * 614400 / 10000 */
241#if 0
242 Xbtimer(0/* Timer A */, 1/* divider = 4 */, s_timerSpeed * 6144 / 10000, Timer_Handler);
243#endif
244#elif defined(DOS)
245 /* */
246#else
247 s_timerTime.it_value.tv_sec = 0;
248 s_timerTime.it_value.tv_usec = s_timerSpeed;
249 s_timerTime.it_interval.tv_sec = 0;
250 s_timerTime.it_interval.tv_usec = s_timerSpeed;
251
252 {
253 struct sigaction timerSignal;
254
255 sigemptyset(&timerSignal.sa_mask);
256 timerSignal.sa_handler = Timer_Handler;
257 timerSignal.sa_flags = 0;
258 sigaction(SIGALRM, &timerSignal, NULL);
259 }
260#endif /* _WIN32 */
261#if !defined(TOS) && !defined(DOS)
262 Timer_InterruptResume();
263#endif /* !defined(TOS) && !defined(DOS) */
264}
265
266/**
267 * Uninitialize the timer.

Callers 1

OpenDune_InitFunction · 0.85

Calls 3

Timer_GetTimeFunction · 0.85
sigactionClass · 0.85
Timer_InterruptResumeFunction · 0.85

Tested by

no test coverage detected