Ethereal-dev: [Ethereal-dev] text2pcap timestamps

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Hamish Moffatt <hamish@xxxxxxxxxxxx>
Date: Mon, 21 Jan 2002 23:47:18 +1100
A colleague of mine has observed a problem similar to what Tim Vale
reported with reading timestamps in text2pcap.

I had a look into it. If you don't read the year as part of the
timestamp, it defaults to 0 (meaning 1900), which can't be represented by
a time_t as returned by mktime(). So mktime() returns an error
and the timestamp is ignored.

If you do specify the year in your timestamp, it works OK (assuming
your timestamp is within +/- 68 years from 1970). You don't need
to specify the month or day of month.

The quick and dirty fix (patch attached) is to have the year
default to 1970. Alternatively, we could initialise the timestamp
to the current time and date and then override the parts of
the timestamp that the user supplies.


regards
Hamish
-- 
Hamish Moffatt VK3SB <hamish@xxxxxxxxxx> <hamish@xxxxxxxxxxxx>
Index: text2pcap.c
===================================================================
RCS file: /cvsroot/ethereal/text2pcap.c,v
retrieving revision 1.10
diff -r1.10 text2pcap.c
655a656
>         timecode.tm_year = 70;