Subversion Repositories Kolibri OS

Rev

Rev 9288 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     SDL - Simple DirectMedia Layer
  3.     Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public
  16.     License along with this library; if not, write to the Free
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.     Sam Lantinga
  20.     slouken@devolution.com
  21. */
  22.  
  23. #ifdef SAVE_RCSID
  24. static char rcsid =
  25.  "@(#) $Id: SDL_systimer.c,v 1.2 2001/04/26 16:50:18 hercules Exp $";
  26. #endif
  27.  
  28. #include <stdio.h>
  29. #include <time.h>
  30. #include <string.h>
  31. #include <errno.h>
  32.  
  33. #include "SDL_error.h"
  34. #include "SDL_timer.h"
  35. #include "SDL_timer_c.h"
  36. #include <sys/ksys.h>
  37.  
  38. #if _POSIX_THREAD_SYSCALL_SOFT
  39. #include <pthread.h>
  40. #endif
  41.  
  42. #if defined(DISABLE_THREADS) || defined(FORK_HACK)
  43. #define USE_ITIMER
  44. #endif
  45.  
  46. static unsigned starttime;
  47.  
  48. void SDL_StartTicks(void)
  49. {
  50.         starttime = _ksys_get_tick_count();
  51. }
  52.  
  53.  
  54. Uint32 SDL_GetTicks (void)
  55. {
  56.         unsigned curtime = _ksys_get_tick_count();
  57.         return (curtime-starttime)*10;
  58. }
  59.  
  60. void SDL_Delay(unsigned ms){
  61.     unsigned start = SDL_GetTicks();
  62.     do{
  63.        _ksys_delay(1);
  64.     }while (SDL_GetTicks()-start < ms);
  65. }
  66.  
  67. int SDL_SYS_TimerInit(void)
  68. {
  69.         return(0);
  70. }
  71.  
  72. void SDL_SYS_TimerQuit(void)
  73. {
  74. }
  75.  
  76. int SDL_SYS_StartTimer(void)
  77. {
  78.         return(0);
  79. }
  80.  
  81. void SDL_SYS_StopTimer(void)
  82. {
  83. }
  84.