X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=39a55435f9720611e17fa1b04218f7e4bee349ab;hb=97f03ad86e7458be79933d91363a38c4d2e35deb;hp=7c2f4353851cb803d8dc8bd43fd1474e65711df8;hpb=959794cfda1f83edc51512211ae5a9f6b1e0b179;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 7c2f4353..39a55435 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -233,20 +233,7 @@ static unsigned int getCurrentMS() { return SDL_GetTicks(); } - -#else /* !TARGET_SDL */ - -#if defined(PLATFORM_UNIX) -static unsigned int getCurrentMS() -{ - struct timeval current_time; - - gettimeofday(¤t_time, NULL); - - return current_time.tv_sec * 1000 + current_time.tv_usec / 1000; -} -#endif /* PLATFORM_UNIX */ -#endif /* !TARGET_SDL */ +#endif static unsigned int mainCounter(int mode) { @@ -283,29 +270,7 @@ static unsigned int mainCounter(int mode) return counter_ms; /* return milliseconds since last init */ } - -#else /* !TARGET_SDL */ - -#if defined(PLATFORM_UNIX) -static unsigned int mainCounter(int mode) -{ - static struct timeval base_time = { 0, 0 }; - struct timeval current_time; - unsigned int counter_ms; - - gettimeofday(¤t_time, NULL); - - /* reset base time in case of counter initializing or wrap-around */ - if (mode == INIT_COUNTER || current_time.tv_sec < base_time.tv_sec) - base_time = current_time; - - counter_ms = (current_time.tv_sec - base_time.tv_sec) * 1000 - + (current_time.tv_usec - base_time.tv_usec) / 1000; - - return counter_ms; /* return milliseconds since last init */ -} -#endif /* PLATFORM_UNIX */ -#endif /* !TARGET_SDL */ +#endif #endif @@ -340,8 +305,6 @@ static void sleep_milliseconds(unsigned int milliseconds_delay) { #if defined(TARGET_SDL) SDL_Delay(milliseconds_delay); -#elif defined(TARGET_ALLEGRO) - rest(milliseconds_delay); #else struct timeval delay; @@ -3728,6 +3691,9 @@ void openErrorFile() Error(ERR_WARN, "cannot open file '%s' for writing: %s", program.error_filename, strerror(errno)); } + + /* error output should be unbuffered so it is not truncated in a crash */ + setbuf(program.error_file, NULL); } void closeErrorFile()