1/*
2 * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * timer_private.h
26 * - timer functions
27 */
28
29/*
30 * Modification History
31 *
32 * May 8, 2000	Dieter Siegmund (dieter@apple)
33 * - created
34 */
35
36#ifndef _S_TIMER_H
37#define _S_TIMER_H
38
39#include <mach/boolean.h>
40#include "dynarray.h"
41#include "symbol_scope.h"
42#include <CoreFoundation/CFDate.h>
43
44typedef long absolute_time_t;
45
46typedef struct timer_callout timer_callout_t;
47
48typedef void (timer_func_t)(void * arg1, void * arg2, void * arg3);
49
50struct timeval		timer_current_time();
51absolute_time_t		timer_current_secs();
52
53INLINE CFAbsoluteTime
54timer_get_current_time(void)
55{
56    return (CFAbsoluteTimeGetCurrent());
57}
58
59/**
60 ** callout functions
61 **/
62timer_callout_t *	timer_callout_init();
63void			timer_callout_free(timer_callout_t * * callout_p);
64
65int			timer_set_relative(timer_callout_t * entry,
66					   struct timeval rel_time,
67					   timer_func_t * func,
68					   void * arg1, void * arg2,
69					   void * arg3);
70int			timer_callout_set(timer_callout_t * callout,
71					  CFAbsoluteTime relative_time,
72					  timer_func_t * func,
73					  void * arg1, void * arg2,
74					  void * arg3);
75void			timer_cancel(timer_callout_t * entry);
76
77boolean_t		timer_time_changed(timer_callout_t * entry);
78
79boolean_t		timer_still_pending(timer_callout_t * entry);
80
81#endif /* _S_TIMER_H */
82