libdvbsub: fix compiler warning: ‘int ftime(timeb*)’ is deprecated

Origin commit data
------------------
Commit: aa7c356582
Author: vanhofen <vanhofen@gmx.de>
Date: 2023-01-25 (Wed, 25 Jan 2023)

Origin message was:
------------------
- libdvbsub: fix compiler warning: ‘int ftime(timeb*)’ is deprecated
This commit is contained in:
vanhofen
2023-01-25 23:43:26 +01:00
parent 795424a29c
commit 24505bce8a

View File

@@ -1,4 +1,4 @@
#include <sys/timeb.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#include <cstdio> #include <cstdio>
#include <cstdarg> #include <cstdarg>
@@ -34,17 +34,15 @@ FILE* Debug::set_file(char* file)
void Debug::print(int level, const char *fmt, ...) void Debug::print(int level, const char *fmt, ...)
{ {
va_list argp; va_list argp;
struct timeb tp; struct timeval tv;
char buf[1024]; char buf[1024];
char tbuf[20]; char tbuf[20];
int len; int len;
struct tm tv;
if (level < level_) { if (level < level_) {
ftime(&tp); gettimeofday(&tv, NULL);
localtime_r (&tp.time, &tv); strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&tv.tv_sec));
strftime (tbuf, 14, "%H:%M:%S", &tv); len = sprintf(buf, "[ %s.%03ld ] ", tbuf, tv.tv_usec / 1000);
len = sprintf(buf, "[ %s.%03d ] ", tbuf, tp.millitm);
va_start(argp, fmt); va_start(argp, fmt);
//vfprintf(fp_, fmt, argp); //vfprintf(fp_, fmt, argp);