Wireshark-users: Re: [Wireshark-users] Time Zone effect in Timestamps of Pcap

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 30 Oct 2011 13:07:37 -0700
On Oct 30, 2011, at 12:48 PM, Dale McCoy wrote:

> Unless I miss my guess, the pcap has timestamps stored in UTC.

Correct:

	$ man pcap-savefile
	PCAP-SAVEFILE(5)                                              PCAP-SAVEFILE(5)



	NAME
	       pcap-savefile - libpcap savefile format

	DESCRIPTION
	       NOTE:  applications  and  libraries should, if possible, use libpcap to
	       read savefiles, rather than having their own code  to  read  savefiles.
	       If,  in the future, a new file format is supported by libpcap, applica-
	       tions and libraries using libpcap to read savefiles  will  be  able  to
	       read  the new format of savefiles, but applications and libraries using
	       their own code to read savefiles will have to be changed to support the
	       new file format.

			...

	       Following the per-file header are zero or  more  packets;  each  packet
	       begins  with  a per-packet header, which is immediately followed by the
	       raw packet data.  The format of the per-packet header is:

	              +---------------------------------------+
	              |      Time stamp, seconds value        |
	              +---------------------------------------+
	              |    Time stamp, microseconds value     |
	              +---------------------------------------+
	              |    Length of captured packet data     |
	              +---------------------------------------+
	              |Un-truncated length of the packet data |
	              +---------------------------------------+
	       All fields in the per-packet header are in the byte order of  the  host
	       writing  the file.  The per-packet header begins with a time stamp giv-
	       ing the approximate time the packet was captured; the time  stamp  con-
	       sists  of  a  4-byte value, giving the time in seconds since January 1,
	       1970, 00:00:00 UTC, followed by a 4-byte  value,  giving  the  time  in
	       microseconds since that second.  Following that are a 4-byte value giv-
	       ing the number of bytes of captured data  that  follow  the  per-packet
	       header  and  a  4-byte value giving the number of bytes that would have
	       been present had the packet not been truncated by the snapshot  length.
	       The two lengths will be equal if the number of bytes of packet data are
	       less than or equal to the snapshot length.

> You can
> set Wireshark to display UTC timestamps, regardless of the local
> timezone, but I'm not aware of any way to force Wireshark to display
> any particular (other, i.e. non-zero) timezone offset.

On UN*X systems, you can run Wireshark with the TZ environment variable set to refer to the other time zone - note that a time zone may have more than just an offset, it may have an offset that changes over time, due to daylight savings time/summer time or due to the region changing its offset for other reasons.