From d12834b470a00fb1b546ed3fe1d7e3a010410850 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 25 Jan 2023 23:43:26 +0100 Subject: [PATCH] =?UTF-8?q?libdvbsub:=20fix=20compiler=20warning:=20?= =?UTF-8?q?=E2=80=98int=20ftime(timeb*)=E2=80=99=20is=20deprecated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/aa7c356582121b4b5b72082d9c9bb24444340525 Author: vanhofen Date: 2023-01-25 (Wed, 25 Jan 2023) Origin message was: ------------------ - libdvbsub: fix compiler warning: ‘int ftime(timeb*)’ is deprecated ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libdvbsub/Debug.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/libdvbsub/Debug.cpp b/lib/libdvbsub/Debug.cpp index 8a7236265..c9fa291ba 100644 --- a/lib/libdvbsub/Debug.cpp +++ b/lib/libdvbsub/Debug.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -34,17 +34,15 @@ FILE* Debug::set_file(char* file) void Debug::print(int level, const char *fmt, ...) { va_list argp; - struct timeb tp; + struct timeval tv; char buf[1024]; char tbuf[20]; int len; - struct tm tv; if (level < level_) { - ftime(&tp); - localtime_r (&tp.time, &tv); - strftime (tbuf, 14, "%H:%M:%S", &tv); - len = sprintf(buf, "[ %s.%03d ] ", tbuf, tp.millitm); + gettimeofday(&tv, NULL); + strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&tv.tv_sec)); + len = sprintf(buf, "[ %s.%03ld ] ", tbuf, tv.tv_usec / 1000); va_start(argp, fmt); //vfprintf(fp_, fmt, argp);