summaryrefslogtreecommitdiff
path: root/packages/ptc/src/c_api/timer.inc
blob: 32f2f6ae660508f54ebef56478221bee96707434 (plain)
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
Function ptc_timer_create : TPTC_TIMER;

Begin
  Try
    ptc_timer_create := TPTC_TIMER(TPTCTimer.Create);
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_timer_create := Nil;
    End;
  End;
End;

Procedure ptc_timer_destroy(obj : TPTC_TIMER);

Begin
  If obj = Nil Then
    Exit;
  Try
    TPTCTimer(obj).Destroy;
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Procedure ptc_timer_set(obj : TPTC_TIMER; time : Double);

Begin
  Try
    TPTCTimer(obj).settime(time);
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Procedure ptc_timer_start(obj : TPTC_TIMER);

Begin
  Try
    TPTCTimer(obj).start;
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Procedure ptc_timer_stop(obj : TPTC_TIMER);

Begin
  Try
    TPTCTimer(obj).stop;
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Function ptc_timer_time(obj : TPTC_TIMER) : Double;

Begin
  Try
    ptc_timer_time := TPTCTimer(obj).time;
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_timer_time := 0;
    End;
  End;
End;

Function ptc_timer_delta(obj : TPTC_TIMER) : Double;

Begin
  Try
    ptc_timer_delta := TPTCTimer(obj).delta;
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_timer_delta := 0;
    End;
  End;
End;

Function ptc_timer_resolution(obj : TPTC_TIMER) : Double;

Begin
  Try
    ptc_timer_resolution := TPTCTimer(obj).resolution;
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_timer_resolution := 0;
    End;
  End;
End;

Procedure ptc_timer_assign(obj, timer : TPTC_TIMER);

Begin
  Try
    TPTCTimer(obj).ASSign(TPTCTimer(timer));
  Except
    On error : TPTCError Do
      ptc_exception_handle(error);
  End;
End;

Function ptc_timer_equals(obj, timer : TPTC_TIMER) : Boolean;

Begin
  Try
    ptc_timer_equals := TPTCTimer(obj).equals(TPTCTimer(timer));
  Except
    On error : TPTCError Do
    Begin
      ptc_exception_handle(error);
      ptc_timer_equals := False;
    End;
  End;
End;