]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/porting.h
Merge branch 'master' of github.com:erlehmann/minetest-delta
[dragonfireclient.git] / src / porting.h
index 71891de399e72ae2b696afd5b3e1fdb02d702601..3cf8df594b82d66f5710c6c24c50317d29cf914d 100644 (file)
@@ -25,12 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define PORTING_HEADER
 
 #include <string>
-// Included for u64 and such
+// Included for u32 and such
 #include "common_irrlicht.h"
 #include "debug.h"
 #include "constants.h"
 
-#ifdef _WIN32
+#ifdef _MSC_VER
        #define SWPRINTF_CHARSTRING L"%S"
 #else
        #define SWPRINTF_CHARSTRING L"%s"
@@ -47,6 +47,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 namespace porting
 {
 
+/*
+       Signal handler (grabs Ctrl-C on POSIX systems)
+*/
+
+void signal_handler_init(void);
+// Returns a pointer to a bool.
+// When the bool is true, program should quit.
+bool * signal_handler_killstatus(void);
+
 /*
        Path of static data directory.
 */
@@ -86,13 +95,20 @@ void initializePaths();
                return GetTickCount();
        }
 #else // Posix
-       #include <sys/timeb.h>
+       #include <sys/time.h>
+       inline u32 getTimeMs()
+       {
+               struct timeval tv;
+               gettimeofday(&tv, NULL);
+               return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+       }
+       /*#include <sys/timeb.h>
        inline u32 getTimeMs()
        {
                struct timeb tb;
                ftime(&tb);
                return tb.time * 1000 + tb.millitm;
-       }
+       }*/
 #endif
 
 } // namespace porting