]> gitweb.factorcode.org Git - factor.git/blob - basis/core-foundation/timers/timers.factor
Remove more system-micros stuff
[factor.git] / basis / core-foundation / timers / timers.factor
1 ! Copyright (C) 2008, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.c-types alien.syntax system math kernel calendar
4 core-foundation core-foundation.time calendar.unix ;
5 IN: core-foundation.timers
6
7 TYPEDEF: void* CFRunLoopTimerRef
8 TYPEDEF: void* CFRunLoopTimerCallBack
9 TYPEDEF: void* CFRunLoopTimerContext
10
11 FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate (
12    CFAllocatorRef allocator,
13    CFAbsoluteTime fireDate,
14    CFTimeInterval interval,
15    CFOptionFlags flags,
16    CFIndex order,
17    CFRunLoopTimerCallBack callout,
18    CFRunLoopTimerContext* context
19 ) ;
20
21 : <CFTimer> ( callback -- timer )
22     [ f system-micros >CFAbsoluteTime 60 0 0 ] dip f CFRunLoopTimerCreate ;
23
24 FUNCTION: void CFRunLoopTimerInvalidate (
25    CFRunLoopTimerRef timer
26 ) ;
27
28 FUNCTION: Boolean CFRunLoopTimerIsValid (
29    CFRunLoopTimerRef timer
30 ) ;
31
32 FUNCTION: void CFRunLoopTimerSetNextFireDate (
33    CFRunLoopTimerRef timer,
34    CFAbsoluteTime fireDate
35 ) ;