diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-08-07 17:11:43 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-08-07 17:37:36 +0200 |
commit | d77ac851c76ff95e6542e93715786d29ba86c51f (patch) | |
tree | 123f4d24ab7b4f39deb3722127c46bb96332d3b9 /tcpdump.c | |
parent | 7df3ddfdcd28191ce412613fecf2a41284476654 (diff) | |
download | tcpdump-d77ac851c76ff95e6542e93715786d29ba86c51f.tar.gz |
Fix local time printing
Using seconds offset from GMT to local time to compute local time give
errors when printing times outside the same daylight saving time period.
Use the localtime() function for default and -tttt cases.
Use the gmtime() function for -ttt and -ttttt cases.
Rename ts_hmsfrac_print() to ts_date_hmsfrac_print().
Remove some variables now useless.
Update some comments.
Diffstat (limited to 'tcpdump.c')
-rw-r--r-- | tcpdump.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -132,7 +132,6 @@ The Regents of the University of California. All rights reserved.\n"; #include "interface.h" #include "addrtoname.h" #include "machdep.h" -#include "gmt2local.h" #include "pcap-missing.h" #include "ascii_strcasecmp.h" @@ -1412,7 +1411,6 @@ main(int argc, char **argv) { int cnt, op, i; bpf_u_int32 localnet = 0, netmask = 0; - int timezone_offset = 0; char *cp, *infile, *cmdbuf, *device, *RFileName, *VFileName, *WFileName; char *endp; pcap_handler callback; @@ -1869,14 +1867,11 @@ main(int argc, char **argv) switch (ndo->ndo_tflag) { case 0: /* Default */ - case 4: /* Default + Date*/ - timezone_offset = gmt2local(0); - break; - case 1: /* No time stamp */ case 2: /* Unix timeval style */ - case 3: /* Microseconds since previous packet */ - case 5: /* Microseconds since first packet */ + case 3: /* Microseconds/nanoseconds since previous packet */ + case 4: /* Date + Default */ + case 5: /* Microseconds/nanoseconds since first packet */ break; default: /* Not supported */ @@ -2138,7 +2133,7 @@ main(int argc, char **argv) capdns = capdns_setup(); #endif /* HAVE_CASPER */ - init_print(ndo, localnet, netmask, timezone_offset); + init_print(ndo, localnet, netmask); #ifndef _WIN32 (void)setsignal(SIGPIPE, cleanup); |