85 lines
1.6 KiB
C
85 lines
1.6 KiB
C
|
// Emacs style mode select -*- C++ -*-
|
||
|
//-----------------------------------------------------------------------------
|
||
|
//
|
||
|
// $Id:$
|
||
|
//
|
||
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||
|
//
|
||
|
// This program is free software; you can redistribute it and/or
|
||
|
// modify it under the terms of the GNU General Public License
|
||
|
// as published by the Free Software Foundation; either version 2
|
||
|
// of the License, or (at your option) any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU General Public License for more details.
|
||
|
//
|
||
|
// $Log:$
|
||
|
//
|
||
|
// DESCRIPTION:
|
||
|
//
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
#include <sys/time.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#include "../doomdef.h"
|
||
|
|
||
|
#include "../ib_system.h"
|
||
|
|
||
|
|
||
|
//
|
||
|
// IB_GetTime
|
||
|
// returns time in 1/70th second tics
|
||
|
//
|
||
|
int IB_GetTime (void)
|
||
|
{
|
||
|
struct timeval tp;
|
||
|
struct timezone tzp;
|
||
|
int newtics;
|
||
|
static int basetime=0;
|
||
|
|
||
|
gettimeofday(&tp, &tzp);
|
||
|
if (!basetime)
|
||
|
basetime = tp.tv_sec;
|
||
|
newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000;
|
||
|
return newtics;
|
||
|
}
|
||
|
|
||
|
|
||
|
//
|
||
|
// IB_Init
|
||
|
//
|
||
|
void IB_Init (void)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
//
|
||
|
// IB_Quit
|
||
|
//
|
||
|
void IB_Quit (void)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
void IB_WaitVBL(int count)
|
||
|
{
|
||
|
#ifdef SGI
|
||
|
sginap(1);
|
||
|
#else
|
||
|
#ifdef SUN
|
||
|
sleep(0);
|
||
|
#else
|
||
|
usleep (count * (1000000/70) );
|
||
|
#endif
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
|
||
|
void IB_Sleep(void)
|
||
|
{
|
||
|
usleep(1);
|
||
|
}
|