Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Functions
time_util.h File Reference
#include <wireshark.h>
#include <time.h>

Go to the source code of this file.

Functions

WS_DLL_PUBLIC time_t mktime_utc (struct tm *tm)
 
WS_DLL_PUBLIC bool tm_is_valid (struct tm *tm)
 
WS_DLL_PUBLIC void get_resource_usage (double *user_time, double *sys_time)
 
WS_DLL_PUBLIC void log_resource_usage (bool reset_delta, const char *format,...)
 
WS_DLL_PUBLIC uint64_t create_timestamp (void)
 
WS_DLL_PUBLIC void ws_tzset (void)
 
WS_DLL_PUBLIC struct timespec * ws_clock_get_realtime (struct timespec *ts)
 
WS_DLL_PUBLIC struct tm * ws_localtime_r (const time_t *timep, struct tm *result)
 
WS_DLL_PUBLIC struct tm * ws_gmtime_r (const time_t *timep, struct tm *result)
 

Detailed Description

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ create_timestamp()

WS_DLL_PUBLIC uint64_t create_timestamp ( void  )

Fetch the number of microseconds since midnight (0 hour), January 1, 1970.

◆ get_resource_usage()

WS_DLL_PUBLIC void get_resource_usage ( double *  user_time,
double *  sys_time 
)

Fetch the process CPU time.

Fetch the current process user and system CPU times, convert them to seconds, and store them in the provided parameters.

Parameters
user_timeSeconds spent in user mode.
sys_timeSeconds spent in system (kernel) mode.

◆ log_resource_usage()

WS_DLL_PUBLIC void log_resource_usage ( bool  reset_delta,
const char *  format,
  ... 
)

Print the process CPU time followed by a log message.

Print the current process user and system CPU times along with the times elapsed since the times were last reset.

Parameters
reset_deltaReset the delta times. This will typically be true when logging the first measurement and false thereafter.
formatPrintf-style format string. Passed to g_string_vprintf.
...Parameters for the format string.

◆ mktime_utc()

WS_DLL_PUBLIC time_t mktime_utc ( struct tm *  tm)

Converts a broken down date representation, relative to UTC, to a timestamp

◆ tm_is_valid()

WS_DLL_PUBLIC bool tm_is_valid ( struct tm *  tm)

Validate the values in a time_t. Currently checks tm_year, tm_mon, tm_mday, tm_hour, tm_min, and tm_sec; disregards tm_wday, tm_yday, and tm_isdst.

Parameters
tmThe struct tm to validate.