ref: 694292fa55e926ca4d7be4a26bd55a9faa41a589
parent: f459280f965b6e737466e2e250226aa809627c13
author: Simon Howard <[email protected]>
date: Fri Dec 30 13:50:53 EST 2005
Millisecond clock function Subversion-branch: /trunk/chocolate-doom Subversion-revision: 234
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_system.c 230 2005-11-17 09:41:24Z fraggle $
+// $Id: i_system.c 234 2005-12-30 18:50:53Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.15 2005/12/30 18:50:53 fraggle
+// Millisecond clock function
+//
// Revision 1.14 2005/11/17 09:41:24 fraggle
// Catch SDL_QUIT event on ENDOOM display
//
@@ -72,7 +75,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_system.c 230 2005-11-17 09:41:24Z fraggle $";
+rcsid[] = "$Id: i_system.c 234 2005-12-30 18:50:53Z fraggle $";
#include <stdlib.h>
@@ -137,11 +140,13 @@
//
// I_GetTime
-// returns time in 1/70th second tics
+// returns time in 1/35th second tics
//
+
+static Uint32 basetime = 0;
+
int I_GetTime (void)
{
- static Uint32 basetime = 0;
Uint32 ticks;
ticks = SDL_GetTicks();
@@ -152,6 +157,22 @@
ticks -= basetime;
return (ticks * 35) / 1000;
+}
+
+//
+// Same as I_GetTime, but returns time in milliseconds
+//
+
+int I_GetTimeMS(void)
+{
+ Uint32 ticks;
+
+ ticks = SDL_GetTicks();
+
+ if (basetime == 0)
+ basetime = ticks;
+
+ return ticks - basetime;
}
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_system.h 97 2005-09-11 16:39:29Z fraggle $
+// $Id: i_system.h 234 2005-12-30 18:50:53Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -48,6 +48,9 @@
// returns current time in tics.
int I_GetTime (void);
+// returns current time in ms
+int I_GetTimeMS (void);
+
// Pause for a specified number of ms
void I_Sleep(int ms);
@@ -99,6 +102,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
+// Revision 1.5 2005/12/30 18:50:53 fraggle
+// Millisecond clock function
+//
// Revision 1.4 2005/09/11 16:39:29 fraggle
// Fix declaration of I_Sleep (not I_Delay) and move to right header
//