aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-11-09 10:38:02 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-11-09 10:38:02 +0000
commit38edae1c718f690281958ff43d1154abc1c96247 (patch)
tree710d4b0220196b0b12691dc2d6d48394b9b8bc59
parentf207c70075d66f226e0eea8f33aae6105925ea25 (diff)
Replace wtap_nstime with nstime_t, remove wtap_nstime_to_sec.
After r50154 nstime_t is inside wsutil/ so wiretap don't need it's own copy. svn path=/trunk/; revision=53184
-rw-r--r--capinfos.c2
-rw-r--r--editcap.c4
-rw-r--r--epan/frame_data.h1
-rw-r--r--reordercap.c12
-rw-r--r--ui/gtk/capture_file_dlg.c2
-rw-r--r--ui/qt/capture_file_dialog.cpp2
-rw-r--r--wiretap/catapult_dct2000.c4
-rw-r--r--wiretap/merge.c5
-rw-r--r--wiretap/mpeg.c4
-rw-r--r--wiretap/netmon.c2
-rw-r--r--wiretap/netxray.c2
-rw-r--r--wiretap/wtap.h8
-rw-r--r--wsutil/nstime.c10
-rw-r--r--wsutil/nstime.h4
14 files changed, 23 insertions, 39 deletions
diff --git a/capinfos.c b/capinfos.c
index ad20ea5e98..89ba0c6aeb 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -448,7 +448,7 @@ time_string(time_t timer, capture_info *cf_info, gboolean want_lf)
}
static double
-secs_nsecs(const struct wtap_nstime * nstime)
+secs_nsecs(const nstime_t * nstime) /* nstime_to_sec */
{
return (nstime->nsecs / 1000000000.0) + (double)nstime->secs;
}
diff --git a/editcap.c b/editcap.c
index c3a03bcc5e..535cc35bae 100644
--- a/editcap.c
+++ b/editcap.c
@@ -182,7 +182,7 @@ static void handle_chopping(chop_t chop, struct wtap_pkthdr *out_phdr,
gboolean adjlen);
static gchar *
-abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time)
+abs_time_to_str_with_sec_resolution(const nstime_t *abs_time)
{
struct tm *tmp;
gchar *buf = (gchar *)g_malloc(16);
@@ -213,7 +213,7 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time)
}
static gchar*
-fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time_val,
+fileset_get_filename_by_pattern(guint idx, const nstime_t *time_val,
gchar *fprefix, gchar *fsuffix)
{
gchar filenum[5+1];
diff --git a/epan/frame_data.h b/epan/frame_data.h
index 72f30db7f3..1276510147 100644
--- a/epan/frame_data.h
+++ b/epan/frame_data.h
@@ -28,6 +28,7 @@
#include <epan/column-info.h>
#include <epan/tvbuff.h>
#include <wsutil/nstime.h>
+#include <wiretap/wtap.h>
#include "ws_symbol_export.h"
#define PINFO_FD_NUM(pinfo) ((pinfo)->fd->num)
diff --git a/reordercap.c b/reordercap.c
index 69b5dbd9ea..6b1cc95cb7 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -59,11 +59,11 @@ static void usage(void)
/* Remember where this frame was in the file */
typedef struct FrameRecord_t {
- gint64 offset;
- guint32 length;
- guint num;
+ gint64 offset;
+ guint32 length;
+ guint num;
- struct wtap_nstime time;
+ nstime_t time;
} FrameRecord_t;
@@ -137,8 +137,8 @@ frames_compare(gconstpointer a, gconstpointer b)
const FrameRecord_t *frame1 = *(const FrameRecord_t **) a;
const FrameRecord_t *frame2 = *(const FrameRecord_t **) b;
- const struct wtap_nstime *time1 = &frame1->time;
- const struct wtap_nstime *time2 = &frame2->time;
+ const nstime_t *time1 = &frame1->time;
+ const nstime_t *time2 = &frame2->time;
if (time1->secs > time2->secs)
return 1;
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index 76690c1f9b..1b9952d94a 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -195,7 +195,7 @@ preview_do(GtkWidget *prev, wtap *wth)
time(&time_preview);
while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) {
phdr = wtap_phdr(wth);
- cur_time = wtap_nstime_to_sec(&phdr->ts);
+ cur_time = nstime_to_sec(&phdr->ts);
if (packets == 0) {
start_time = cur_time;
stop_time = cur_time;
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 6b452352ed..a048b4dbb0 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -785,7 +785,7 @@ void CaptureFileDialog::preview(const QString & path)
time(&time_preview);
while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) {
phdr = wtap_phdr(wth);
- cur_time = wtap_nstime_to_sec(&phdr->ts);
+ cur_time = nstime_to_sec(&phdr->ts);
if(packets == 0) {
start_time = cur_time;
stop_time = cur_time;
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c
index 756671554e..22a04f6f92 100644
--- a/wiretap/catapult_dct2000.c
+++ b/wiretap/catapult_dct2000.c
@@ -546,8 +546,8 @@ catapult_dct2000_close(wtap *wth)
/***************************/
typedef struct {
- gboolean first_packet_written;
- struct wtap_nstime start_time;
+ gboolean first_packet_written;
+ nstime_t start_time;
} dct2000_dump_t;
/*****************************************************/
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 264f66c3ed..34f71ec7c5 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -150,7 +150,8 @@ merge_max_snapshot_length(int count, merge_in_file_t in_files[])
* returns TRUE if first argument is earlier than second
*/
static gboolean
-is_earlier(struct wtap_nstime *l, struct wtap_nstime *r) {
+is_earlier(nstime_t *l, nstime_t *r) /* XXX, move to nstime.c */
+{
if (l->secs > r->secs) { /* left is later */
return FALSE;
} else if (l->secs < r->secs) { /* left is earlier */
@@ -183,7 +184,7 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
{
int i;
int ei = -1;
- struct wtap_nstime tv = { sizeof(time_t) > sizeof(int) ? LONG_MAX : INT_MAX, INT_MAX };
+ nstime_t tv = { sizeof(time_t) > sizeof(int) ? LONG_MAX : INT_MAX, INT_MAX };
struct wtap_pkthdr *phdr;
/*
diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c
index 7a33985063..3767978747 100644
--- a/wiretap/mpeg.c
+++ b/wiretap/mpeg.c
@@ -47,7 +47,7 @@
#define PES_VALID(n) (((n) >> 8 & 0xffffff) == PES_PREFIX)
typedef struct {
- struct wtap_nstime now;
+ nstime_t now;
time_t t0;
} mpeg_t;
@@ -100,7 +100,7 @@ mpeg_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
guint32 n;
int bytes_read = mpeg_read_header(wth, err, err_info, &n);
unsigned int packet_size;
- struct wtap_nstime ts = mpeg->now;
+ nstime_t ts = mpeg->now;
if (bytes_read == -1)
return FALSE;
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index b23ba625d0..4b41f35168 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -927,7 +927,7 @@ netmon_sequential_close(wtap *wth)
typedef struct {
gboolean got_first_record_time;
- struct wtap_nstime first_record_time;
+ nstime_t first_record_time;
guint32 frame_table_offset;
guint32 *frame_table;
guint frame_table_index;
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index c83c7664e5..2d4481260e 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1440,7 +1440,7 @@ netxray_set_phdr(wtap *wth, Buffer *buf, int len,
typedef struct {
gboolean first_frame;
- struct wtap_nstime start;
+ nstime_t start;
guint32 nframes;
} netxray_dump_t;
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 9ff595ca2d..e4339ca71b 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -30,6 +30,7 @@
#include <glib.h>
#include <time.h>
#include <wiretap/buffer.h>
+#include <wsutil/nstime.h>
#include "ws_symbol_export.h"
#ifdef __cplusplus
@@ -865,14 +866,9 @@ union wtap_pseudo_header {
struct llcp_phdr llcp;
};
-struct wtap_nstime {
- time_t secs;
- int nsecs;
-};
-
struct wtap_pkthdr {
guint32 presence_flags; /* what stuff do we have? */
- struct wtap_nstime ts;
+ nstime_t ts;
guint32 caplen; /* data length in the file */
guint32 len; /* data length on the wire */
int pkt_encap;
diff --git a/wsutil/nstime.c b/wsutil/nstime.c
index e88818856a..4c93bc16e7 100644
--- a/wsutil/nstime.c
+++ b/wsutil/nstime.c
@@ -178,16 +178,6 @@ double nstime_to_sec(const nstime_t *nstime)
}
/*
- * function: wtap_nstime_to_sec
- * converts wtap_nstime to double, time base is seconds
- */
-
-double wtap_nstime_to_sec(const struct wtap_nstime *nstime)
-{
- return ((double)nstime->secs + (double)nstime->nsecs/1000000000);
-}
-
-/*
* Editor modelines
*
* Local Variables:
diff --git a/wsutil/nstime.h b/wsutil/nstime.h
index 01fd469b62..41685fd09b 100644
--- a/wsutil/nstime.h
+++ b/wsutil/nstime.h
@@ -27,7 +27,6 @@
#include <time.h>
-#include <wiretap/wtap.h>
#include "ws_symbol_export.h"
#ifdef __cplusplus
@@ -105,9 +104,6 @@ WS_DLL_PUBLIC double nstime_to_msec(const nstime_t *nstime);
/** converts nstime to double, time base is seconds */
WS_DLL_PUBLIC double nstime_to_sec(const nstime_t *nstime);
-/** converts wtap_nstime to double, time base is seconds */
-WS_DLL_PUBLIC double wtap_nstime_to_sec(const struct wtap_nstime *nstime);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */