1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25  *
26  */
27 
28 #ifndef ICB_DEBUG_PC_H
29 #define ICB_DEBUG_PC_H
30 
31 #include "common/system.h"
32 
33 namespace ICB {
34 
35 extern bool8 zdebug;
36 
37 void Fatal_error(const char *format, ...);
38 void Message_box(const char *text, ...);
39 void ExitWithReport(char *format, ...);
40 void Zdebug(const char *, ...);
41 void Zdebug(uint32 stream, const char *format, ...);
42 void Tdebug(const char *file, const char *format, ...);
43 
44 #define Real_Fatal_error Fatal_error
45 #define Real_Message_box Message_box
46 
47 // XXX: FIXME:  This function stores the number of elapsed microseconds in an unsigned 32-bit int, which will overflow in just over an
48 // hour...
49 //             We should make sure all the client code deals with this properly!
GetMicroTimer(void)50 inline uint32 GetMicroTimer(void) {
51 	static int32 first = 1;
52 
53 	static TimeDate startTime;
54 	if (first) {
55 		g_system->getTimeAndDate(startTime);
56 		first = 0;
57 	}
58 
59 	TimeDate curTime;
60 	g_system->getTimeAndDate(curTime);
61 	return (uint32)(((curTime.tm_sec - startTime.tm_sec) * 1000000));// + (curTime.tv_usec - startTime.tv_usec)); // TODO: Fix micro-second-precision.
62 }
63 
64 } // End of namespace ICB
65 
66 #endif // #ifndef DEBUG_PC_H
67