diff options
author | 2025-06-12 07:28:55 +0200 | |
---|---|---|
committer | 2025-06-12 07:28:55 +0200 | |
commit | 8b316af7539650e7ed8f913530d9a5473bf664ed (patch) | |
tree | 1fc5a0d3d439a9c2704f938a9a781806369e3805 /common | |
parent | 9d26a1636ba684b600b5cfa0e96e7cb648501539 (diff) | |
download | libimobiledevice-8b316af7539650e7ed8f913530d9a5473bf664ed.tar.gz libimobiledevice-8b316af7539650e7ed8f913530d9a5473bf664ed.tar.bz2 |
debug: Silence some compiler warnings
Diffstat (limited to 'common')
-rw-r--r-- | common/debug.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/debug.c b/common/debug.c index 11aab00..7a593fc 100644 --- a/common/debug.c +++ b/common/debug.c @@ -30,6 +30,9 @@ #include <stdint.h> #include <stdlib.h> #include <time.h> +#ifndef _WIN32 +#include <sys/time.h> +#endif #include "src/idevice.h" #include "debug.h" @@ -51,24 +54,24 @@ void internal_set_debug_level(int level) #ifndef STRIP_DEBUG_CODE static void debug_print_line(const char *func, const char *file, int line, const char *buffer) { - char str_time[16]; + char str_time[24]; #ifdef _WIN32 SYSTEMTIME lt; GetLocalTime(<); - snprintf(str_time, 13, "%02d:%02d:%02d.%03d", lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds); + snprintf(str_time, 24, "%02d:%02d:%02d.%03d", lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds); #else #ifdef HAVE_GETTIMEOFDAY struct timeval tv; - struct tm tp_; struct tm *tp; gettimeofday(&tv, NULL); #ifdef HAVE_LOCALTIME_R + struct tm tp_; tp = localtime_r(&tv.tv_sec, &tp_); #else tp = localtime(&tv.tv_sec); #endif strftime(str_time, 9, "%H:%M:%S", tp); - snprintf(str_time+8, 5, ".%03d", (int)tv.tv_usec/1000); + snprintf(str_time+8, 10, ".%03d", (int)tv.tv_usec/1000); #else time_t the_time; time(&the_time); |