summaryrefslogtreecommitdiff
path: root/src/i_system.c
diff options
context:
space:
mode:
authorSimon Howard2005-12-30 18:50:53 +0000
committerSimon Howard2005-12-30 18:50:53 +0000
commit694292fa55e926ca4d7be4a26bd55a9faa41a589 (patch)
treeeb5537e7612ef977fb925d865376528251ac0202 /src/i_system.c
parentf459280f965b6e737466e2e250226aa809627c13 (diff)
downloadchocolate-doom-694292fa55e926ca4d7be4a26bd55a9faa41a589.tar.gz
chocolate-doom-694292fa55e926ca4d7be4a26bd55a9faa41a589.tar.bz2
chocolate-doom-694292fa55e926ca4d7be4a26bd55a9faa41a589.zip
Millisecond clock function
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 234
Diffstat (limited to 'src/i_system.c')
-rw-r--r--src/i_system.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/i_system.c b/src/i_system.c
index 7176f863..ad40d532 100644
--- 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 @@ byte* I_ZoneBase (int* size)
//
// 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();
@@ -154,6 +159,22 @@ int I_GetTime (void)
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;
+}
+
//