2 * Submitted by Edwin Groothuis <wireshark@mavetju.org>
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later*/
10 #ifndef __TIME_SHIFT_H__
11 #define __TIME_SHIFT_H__
14 #include <wsutil/nstime.h>
18 #endif /* __cplusplus */
21 * XXX - We might want to move all of this somewhere more accessible to
22 * editcap so that we can make its time adjustments more versatile.
26 * Parse a time string and fill in each component.
28 * If year, month, and day are non-NULL a full time format "[YYYY-MM-DD] hh:mm:ss[.decimals]"
29 * is allowed. Otherwise an offset format "[-][[hh:]mm:]ss[.decimals]" is allowed.
31 * @param time_text Time string
32 * @param year Year. May be NULL
33 * @param month Month. May be NULL
34 * @param day Day. May be NULL.
35 * @param negative Time offset is negative. May be NULL if year, month, and day are not NULL.
36 * @param hour Hours. Must not be NULL.
37 * @param minute Minutes. Must not be NULL.
38 * @param second Seconds. Must not be NULL.
40 * @return NULL on success or an error description on failure.
43 const gchar * time_string_parse(const gchar *time_text, int *year, int *month, int *day, gboolean *negative, int *hour, int *minute, long double *second);
45 /** Shift all packets by an offset
47 * @param cf Capture file to shift
48 * @param offset_text String representation of the offset.
50 * @return NULL on success or an error description on failure.
52 const gchar * time_shift_all(capture_file *cf, const gchar *offset_text);
54 /* Set the time for a single packet
56 * @param cf Capture file to set
57 * @param packet_num Packet to set
58 * @param time_text String representation of the time
60 * @return NULL on success or an error description on failure.
62 const gchar * time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text);
64 /* Set the time for two packets and extrapolate the rest
66 * @param cf Capture file to set
67 * @param packet1_num First packet to set
68 * @param time1_text String representation of the first packet time
69 * @param packet2_num Second packet to set
70 * @param time2_text String representation of the second packet time
72 * @return NULL on success or an error description on failure.
74 const gchar * time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text, guint packet2_num, const gchar *time2_text);
76 /* Reset the times for all packets
78 * @param cf Capture file to set
80 * @return NULL on success or an error description on failure.
82 const gchar * time_shift_undo(capture_file *cf);
86 #endif /* __cplusplus */
88 #endif /* __TIME_SHIFT_H__ */
91 * Editor modelines - http://www.wireshark.org/tools/modelines.html
96 * indent-tabs-mode: nil
99 * vi: set shiftwidth=4 tabstop=8 expandtab:
100 * :indentSize=4:tabSize=8:noTabs=true: