src/timer/beos/SDL_systimer.c
author Sam Lantinga
Fri, 25 Mar 2011 14:45:04 -0700
changeset 5514 6bd701987ba9
parent 5262 b530ef003506
child 5535 96594ac5fd1a
permissions -rw-r--r--
Added high resolution timing API: SDL_GetPerformanceCounter(), SDL_GetPerformanceFrequency()
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@5262
     3
    Copyright (C) 1997-2011 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@252
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@0
    23
slouken@1635
    24
#ifdef SDL_TIMER_BEOS
slouken@1635
    25
slouken@0
    26
#include <be/kernel/OS.h>
slouken@0
    27
slouken@0
    28
#include "SDL_timer.h"
slouken@0
    29
slouken@0
    30
static bigtime_t start;
slouken@0
    31
slouken@1895
    32
void
slouken@1895
    33
SDL_StartTicks(void)
slouken@0
    34
{
slouken@1895
    35
    /* Set first ticks value */
slouken@1895
    36
    start = system_time();
slouken@0
    37
}
slouken@0
    38
slouken@1895
    39
Uint32
slouken@1895
    40
SDL_GetTicks(void)
slouken@0
    41
{
slouken@1895
    42
    return ((system_time() - start) / 1000);
slouken@0
    43
}
slouken@0
    44
slouken@5514
    45
Uint64
slouken@5514
    46
SDL_GetPerformanceCounter(void)
slouken@5514
    47
{
slouken@5514
    48
    return system_time();
slouken@5514
    49
}
slouken@5514
    50
slouken@5514
    51
Uint64
slouken@5514
    52
SDL_GetPerformanceFrequency(void)
slouken@5514
    53
{
slouken@5514
    54
    return 1000000;
slouken@5514
    55
}
slouken@5514
    56
slouken@1895
    57
void
slouken@1895
    58
SDL_Delay(Uint32 ms)
slouken@0
    59
{
slouken@1895
    60
    snooze(ms * 1000);
slouken@0
    61
}
slouken@0
    62
slouken@5111
    63
#endif /* SDL_TIMER_BEOS */
slouken@0
    64
slouken@1895
    65
/* vi: set ts=4 sw=4 expandtab: */