timer.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. Function ptc_timer_create : TPTC_TIMER;
  2. Begin
  3. Try
  4. ptc_timer_create := TPTC_TIMER(TPTCTimer.Create);
  5. Except
  6. On error : TPTCError Do
  7. Begin
  8. ptc_exception_handle(error);
  9. ptc_timer_create := Nil;
  10. End;
  11. End;
  12. End;
  13. Procedure ptc_timer_destroy(obj : TPTC_TIMER);
  14. Begin
  15. If obj = Nil Then
  16. Exit;
  17. Try
  18. TPTCTimer(obj).Destroy;
  19. Except
  20. On error : TPTCError Do
  21. ptc_exception_handle(error);
  22. End;
  23. End;
  24. Procedure ptc_timer_set(obj : TPTC_TIMER; time : Double);
  25. Begin
  26. Try
  27. TPTCTimer(obj).settime(time);
  28. Except
  29. On error : TPTCError Do
  30. ptc_exception_handle(error);
  31. End;
  32. End;
  33. Procedure ptc_timer_start(obj : TPTC_TIMER);
  34. Begin
  35. Try
  36. TPTCTimer(obj).start;
  37. Except
  38. On error : TPTCError Do
  39. ptc_exception_handle(error);
  40. End;
  41. End;
  42. Procedure ptc_timer_stop(obj : TPTC_TIMER);
  43. Begin
  44. Try
  45. TPTCTimer(obj).stop;
  46. Except
  47. On error : TPTCError Do
  48. ptc_exception_handle(error);
  49. End;
  50. End;
  51. Function ptc_timer_time(obj : TPTC_TIMER) : Double;
  52. Begin
  53. Try
  54. ptc_timer_time := TPTCTimer(obj).time;
  55. Except
  56. On error : TPTCError Do
  57. Begin
  58. ptc_exception_handle(error);
  59. ptc_timer_time := 0;
  60. End;
  61. End;
  62. End;
  63. Function ptc_timer_delta(obj : TPTC_TIMER) : Double;
  64. Begin
  65. Try
  66. ptc_timer_delta := TPTCTimer(obj).delta;
  67. Except
  68. On error : TPTCError Do
  69. Begin
  70. ptc_exception_handle(error);
  71. ptc_timer_delta := 0;
  72. End;
  73. End;
  74. End;
  75. Function ptc_timer_resolution(obj : TPTC_TIMER) : Double;
  76. Begin
  77. Try
  78. ptc_timer_resolution := TPTCTimer(obj).resolution;
  79. Except
  80. On error : TPTCError Do
  81. Begin
  82. ptc_exception_handle(error);
  83. ptc_timer_resolution := 0;
  84. End;
  85. End;
  86. End;
  87. Procedure ptc_timer_assign(obj, timer : TPTC_TIMER);
  88. Begin
  89. Try
  90. TPTCTimer(obj).ASSign(TPTCTimer(timer));
  91. Except
  92. On error : TPTCError Do
  93. ptc_exception_handle(error);
  94. End;
  95. End;
  96. Function ptc_timer_equals(obj, timer : TPTC_TIMER) : Boolean;
  97. Begin
  98. Try
  99. ptc_timer_equals := TPTCTimer(obj).equals(TPTCTimer(timer));
  100. Except
  101. On error : TPTCError Do
  102. Begin
  103. ptc_exception_handle(error);
  104. ptc_timer_equals := False;
  105. End;
  106. End;
  107. End;