[chocolate-doom] 06/79: Millisecond clock function

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:07:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.3
in repository chocolate-doom.

commit 694292fa55e926ca4d7be4a26bd55a9faa41a589
Author: Simon Howard <fraggle at gmail.com>
Date:   Fri Dec 30 18:50:53 2005 +0000

    Millisecond clock function
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 234
---
 src/i_system.c | 29 +++++++++++++++++++++++++----
 src/i_system.h |  8 +++++++-
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/src/i_system.c b/src/i_system.c
index 7176f86..ad40d53 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;
+}
+
 
 
 //
diff --git a/src/i_system.h b/src/i_system.h
index 10766d0..02a8c86 100644
--- 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 @@ byte*	I_ZoneBase (int *size);
 // 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 @@ void I_Error (char *error, ...);
 //-----------------------------------------------------------------------------
 //
 // $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
 //

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list