aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2020-01-21 14:26:38 -0800
committerGuy Harris <guy@alum.mit.edu>2020-01-21 23:37:05 +0000
commita152e041fa893ba672dcb1337c596ec15fdb0c0d (patch)
tree17debde7ec0104d70d12e67bb4e5d8764ef076d1 /wiretap
parentd44c5e45cbb5e9ece96cab6a62793dd24ec52b7d (diff)
Put various epoch time deltas into wsutil/epochs.h.
There are some deltas between the UN*X epoch and other epochs that are used in a number of places; put them into a header. Change-Id: Ia2d9d69b9d91352d730d97d9e4897518635b4861 Reviewed-on: https://code.wireshark.org/review/35895 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/peekclassic.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index 78ba318ab0..bc9f70bb3b 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -24,9 +24,13 @@
#include "config.h"
#include <errno.h>
#include <string.h>
+
+#include <wsutil/epochs.h>
+
#include "wtap-int.h"
#include "file_wrappers.h"
#include "peekclassic.h"
+
/* CREDITS
*
* This file decoder could not have been writen without examining how
@@ -130,8 +134,6 @@ typedef struct peekclassic_utime {
#define STATUS_SLICED 0x20 /* Sliced (cut short by snaplen?) */
#define STATUS_HIDDEN 0x80 /* Hidden (in the *Peek GUI?) */
-static const unsigned int mac2unix = 2082844800u;
-
typedef struct {
time_t reference_time;
} peekclassic_t;
@@ -298,7 +300,7 @@ wtap_open_return_val peekclassic_open(wtap *wth, int *err, gchar **err_info)
g_ntohl(ep_hdr.secondary.v567.linkSpeed);
/* Get the reference time as a time_t */
- reference_time = ep_hdr.secondary.v567.timeDate - mac2unix;
+ reference_time = ep_hdr.secondary.v567.timeDate - EPOCH_DELTA_1904_01_01_00_00_00_UTC;
break;
default:
@@ -436,7 +438,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
rec->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN|WTAP_HAS_PACK_FLAGS;
tsecs = (time_t) (timestamp/1000000);
tusecs = (guint32) (timestamp - tsecs*1000000);
- rec->ts.secs = tsecs - mac2unix;
+ rec->ts.secs = tsecs - EPOCH_DELTA_1904_01_01_00_00_00_UTC;
rec->ts.nsecs = tusecs * 1000;
rec->rec_header.packet_header.len = length;
rec->rec_header.packet_header.caplen = sliceLength;