2 * Submitted by Edwin Groothuis <wireshark@mavetju.org>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __TIME_SHIFT_H__
26 #define __TIME_SHIFT_H__
29 #include <wsutil/nstime.h>
33 #endif /* __cplusplus */
36 * XXX - We might want to move all of this somewhere more accessible to
37 * editcap so that we can make its time adjustments more versatile.
41 * Parse a time string and fill in each component.
43 * If year, month, and day are non-NULL a full time format "[YYYY-MM-DD] hh:mm:ss[.decimals]"
44 * is allowed. Otherwise an offset format "[-][[hh:]mm:]ss[.decimals]" is allowed.
46 * @param time_text Time string
47 * @param year Year. May be NULL
48 * @param month Month. May be NULL
49 * @param day Day. May be NULL.
50 * @param negative Time offset is negative. May be NULL if year, month, and day are not NULL.
51 * @param hour Hours. Must not be NULL.
52 * @param minute Minutes. Must not be NULL.
53 * @param second Seconds. Must not be NULL.
55 * @return NULL on success or an error description on failure.
58 const gchar
* time_string_parse(const gchar
*time_text
, int *year
, int *month
, int *day
, gboolean
*negative
, int *hour
, int *minute
, long double *second
);
60 /** Shift all packets by an offset
62 * @param cf Capture file to shift
63 * @param offset_text String representation of the offset.
65 * @return NULL on success or an error description on failure.
67 const gchar
* time_shift_all(capture_file
*cf
, const gchar
*offset_text
);
69 /* Set the time for a single packet
71 * @param cf Capture file to set
72 * @param packet_num Packet to set
73 * @param time_text String representation of the time
75 * @return NULL on success or an error description on failure.
77 const gchar
* time_shift_settime(capture_file
*cf
, guint packet_num
, const gchar
*time_text
);
79 /* Set the time for two packets and extrapolate the rest
81 * @param cf Capture file to set
82 * @param packet1_num First packet to set
83 * @param time1_text String representation of the first packet time
84 * @param packet2_num Second packet to set
85 * @param time2_text String representation of the second packet time
87 * @return NULL on success or an error description on failure.
89 const gchar
* time_shift_adjtime(capture_file
*cf
, guint packet1_num
, const gchar
*time1_text
, guint packet2_num
, const gchar
*time2_text
);
91 /* Reset the times for all packets
93 * @param cf Capture file to set
95 * @return NULL on success or an error description on failure.
97 const gchar
* time_shift_undo(capture_file
*cf
);
101 #endif /* __cplusplus */
103 #endif /* __TIME_SHIFT_H__ */