wslog: 'struct timespec' is C11, use that
This commit is contained in:
parent
fe30cf2f8a
commit
81de22e81a
|
@ -319,7 +319,7 @@ static gboolean need_timeout_workaround;
|
|||
|
||||
static void
|
||||
dumpcap_log_writer(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap,
|
||||
void *user_data);
|
||||
|
@ -5574,7 +5574,7 @@ main(int argc, char *argv[])
|
|||
|
||||
static void
|
||||
dumpcap_log_writer(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap,
|
||||
void *user_data _U_)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
void
|
||||
console_log_writer(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap,
|
||||
void *user_data _U_)
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
*/
|
||||
void
|
||||
console_log_writer(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap,
|
||||
void *user_data);
|
||||
|
|
|
@ -226,12 +226,19 @@ ws_clock_get_realtime(struct timespec *ts)
|
|||
return ts;
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
/* Fall back on gettimeofday(). */
|
||||
struct timeval usectimenow;
|
||||
gettimeofday(&usectimenow, NULL);
|
||||
ts->tv_sec = usectimenow.tv_sec;
|
||||
ts->tv_nsec = usectimenow.tv_usec*1000;
|
||||
return ts;
|
||||
#else
|
||||
/* Fall back on time(). */
|
||||
ts->tv_sec = time(NULL);
|
||||
ts->tv_nsec = 0;
|
||||
return ts;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -943,10 +943,10 @@ static void log_write_dispatch(const char *domain, enum ws_log_level level,
|
|||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap)
|
||||
{
|
||||
ws_log_time_t tstamp;
|
||||
struct timespec tstamp;
|
||||
struct tm *cookie = NULL;
|
||||
|
||||
ws_clock_get_realtime((struct timespec *)&tstamp);
|
||||
ws_clock_get_realtime(&tstamp);
|
||||
|
||||
if (custom_log) {
|
||||
va_list user_ap_copy;
|
||||
|
@ -1063,7 +1063,7 @@ void ws_log_buffer_full(const char *domain, enum ws_log_level level,
|
|||
|
||||
|
||||
void ws_log_file_writer(FILE *fp, const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap)
|
||||
{
|
||||
|
@ -1076,7 +1076,7 @@ void ws_log_file_writer(FILE *fp, const char *domain, enum ws_log_level level,
|
|||
|
||||
|
||||
void ws_log_console_writer(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap)
|
||||
{
|
||||
|
|
|
@ -36,15 +36,10 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
time_t tv_sec; /* -1 if no time source is available */
|
||||
long tv_nsec; /* -1 if subsecond resolution is not available */
|
||||
} ws_log_time_t;
|
||||
|
||||
|
||||
/** Callback for registering a log writer. */
|
||||
typedef void (ws_log_writer_cb)(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap,
|
||||
void *user_data);
|
||||
|
@ -56,14 +51,14 @@ typedef void (ws_log_writer_free_data_cb)(void *user_data);
|
|||
|
||||
WS_DLL_PUBLIC
|
||||
void ws_log_file_writer(FILE *fp, const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap);
|
||||
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
void ws_log_console_writer(const char *domain, enum ws_log_level level,
|
||||
ws_log_time_t timestamp,
|
||||
struct timespec timestamp,
|
||||
const char *file, int line, const char *func,
|
||||
const char *user_format, va_list user_ap);
|
||||
|
||||
|
|
Loading…
Reference in New Issue