| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Functions
ws_strptime.h File Reference
`#include <wireshark.h>`
`#include <time.h>`

Go to the source code of this file.

## Classes
struct | ws_timezone
| Portable representation of timezone offset and name. More...

## Functions
WS_DLL_PUBLIC char * | ws_strptime (const char *buf, const char *format, struct tm *tm, struct ws_timezone *zonep)
| Parse a date/time string using NetBSD's strptime() with the "C" locale.
WS_DLL_PUBLIC char * | ws_strptime_p (const char *buf, const char *format, struct tm *tm)
| Portable wrapper around the system's strptime().

## 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

## ◆ ws_strptime()

WS_DLL_PUBLIC char * ws_strptime | ( | const char * | buf,
|  | const char * | format,
|  | struct tm * | tm,
|  | struct ws_timezone * | zonep
| ) |  |

Parse a date/time string using NetBSD's strptime() with the "C" locale.

This function is a modified version of NetBSD's `strptime()`, adapted to always use the "C" locale for consistent parsing behavior across platforms. It converts the input string `buf` into broken-down time components stored in `tm`, according to the format string `format`. If available, timezone information is stored in the optional `zonep` structure.

Parameters

  buf | Input string containing the date/time representation.
  format | Format string specifying the expected structure of `buf`.
  tm | Output structure to receive parsed time components.
  zonep | Optional output for timezone offset and name (may be NULL).

Returns
  Pointer to the first character not processed, or NULL on failure.

## ◆ ws_strptime_p()

WS_DLL_PUBLIC char * ws_strptime_p | ( | const char * | buf,
|  | const char * | format,
|  | struct tm * | tm
| ) |  |

Portable wrapper around the system's strptime().

Provides a compatibility layer for parsing date/time strings using the system's native `strptime()` implementation. This wrapper ensures consistent behavior across platforms that support `strptime()`, without enforcing locale or timezone extensions.

Parameters

  buf | Input string containing the date/time representation.
  format | Format string specifying the expected structure of `buf`.
  tm | Output structure to receive parsed time components.

Returns
  Pointer to the first character not processed, or NULL on failure.