diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-02-27 19:49:28 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-02-28 03:50:26 +0000 |
commit | 3b235615bf741dbe2fff5938a708cd9ab6865384 (patch) | |
tree | 6e822e40e7eda8f3559645a390068b1b71d47777 /wiretap/peekclassic.c | |
parent | 30d878f070e18209eef9c240b53ab937d9587f69 (diff) |
Don't use struct timeval if we only care about seconds.
time_t suffices in that case.
Change-Id: Ica7a79fb6f8c7cc7fb6decd5fcd391dccfdb3fc6
Reviewed-on: https://code.wireshark.org/review/7440
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/peekclassic.c')
-rw-r--r-- | wiretap/peekclassic.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c index b58ab15758..613018e2dd 100644 --- a/wiretap/peekclassic.c +++ b/wiretap/peekclassic.c @@ -134,7 +134,7 @@ static const peekclassic_encap_lookup_t peekclassic_encap[] = { (sizeof (peekclassic_encap) / sizeof (peekclassic_encap[0])) typedef struct { - struct timeval reference_time; + time_t reference_time; } peekclassic_t; static gboolean peekclassic_read_v7(wtap *wth, int *err, gchar **err_info, @@ -153,7 +153,7 @@ static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh, wtap_open_return_val peekclassic_open(wtap *wth, int *err, gchar **err_info) { peekclassic_header_t ep_hdr; - struct timeval reference_time; + time_t reference_time; int file_encap; peekclassic_t *peekclassic; @@ -298,10 +298,8 @@ wtap_open_return_val peekclassic_open(wtap *wth, int *err, gchar **err_info) ep_hdr.secondary.v567.linkSpeed = g_ntohl(ep_hdr.secondary.v567.linkSpeed); - /* Get the reference time as a "struct timeval" */ - reference_time.tv_sec = - ep_hdr.secondary.v567.timeDate - mac2unix; - reference_time.tv_usec = 0; + /* Get the reference time as a time_t */ + reference_time = ep_hdr.secondary.v567.timeDate - mac2unix; break; default: @@ -573,8 +571,7 @@ static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh, phdr->rec_type = REC_TYPE_PACKET; phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; /* timestamp is in milliseconds since reference_time */ - phdr->ts.secs = peekclassic->reference_time.tv_sec - + (timestamp / 1000); + phdr->ts.secs = peekclassic->reference_time + (timestamp / 1000); phdr->ts.nsecs = 1000 * (timestamp % 1000) * 1000; phdr->len = length; phdr->caplen = sliceLength; |