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 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __TIME_SHIFT_H__
24 #define __TIME_SHIFT_H__
27 #include <wsutil/nstime.h>
31 #endif /* __cplusplus */
34 * XXX - We might want to move all of this somewhere more accessible to
35 * editcap so that we can make its time adjustments more versatile.
39 * Parse a time string and fill in each component.
41 * If year, month, and day are non-NULL a full time format "[YYYY-MM-DD] hh:mm:ss[.decimals]"
42 * is allowed. Otherwise an offset format "[-][[hh:]mm:]ss[.decimals]" is allowed.
44 * @param time_text Time string
45 * @param year Year. May be NULL
46 * @param month Month. May be NULL
47 * @param day Day. May be NULL.
48 * @param negative Time offset is negative. May be NULL if year, month, and day are not NULL.
49 * @param hour Hours. Must not be NULL.
50 * @param minute Minutes. Must not be NULL.
51 * @param second Seconds. Must not be NULL.
53 * @return NULL on success or an error description on failure.
56 const gchar * time_string_parse(const gchar *time_text, int *year, int *month, int *day, gboolean *negative, int *hour, int *minute, long double *second);
58 /** Shift all packets by an offset
60 * @param cf Capture file to shift
61 * @param offset_text String representation of the offset.
63 * @return NULL on success or an error description on failure.
65 const gchar * time_shift_all(capture_file *cf, const gchar *offset_text);
67 /* Set the time for a single packet
69 * @param cf Capture file to set
70 * @param packet_num Packet to set
71 * @param time_text String representation of the time
73 * @return NULL on success or an error description on failure.
75 const gchar * time_shift_settime(capture_file *cf, guint packet_num, const gchar *time_text);
77 /* Set the time for two packets and extrapolate the rest
79 * @param cf Capture file to set
80 * @param packet1_num First packet to set
81 * @param time1_text String representation of the first packet time
82 * @param packet2_num Second packet to set
83 * @param time2_text String representation of the second packet time
85 * @return NULL on success or an error description on failure.
87 const gchar * time_shift_adjtime(capture_file *cf, guint packet1_num, const gchar *time1_text, guint packet2_num, const gchar *time2_text);
89 /* Reset the times for all packets
91 * @param cf Capture file to set
93 * @return NULL on success or an error description on failure.
95 const gchar * time_shift_undo(capture_file *cf);
99 #endif /* __cplusplus */
102 * Editor modelines - http://www.wireshark.org/tools/modelines.html
107 * indent-tabs-mode: nil
110 * vi: set shiftwidth=4 tabstop=8 expandtab:
111 * :indentSize=4:tabSize=8:noTabs=true:
114 #endif /* __TIME_SHIFT_H__ */