How to set packet timestamp in a dissector
I'm writing a custom dissector to parse data from a serial port. I'm passing the packets to Wireshark by sending udp packets. Wireshark seems to set the timestamp of packets based on the time of arrival into Wireshark. In my protocol, each message received on the serial port has a clock value, which is a clock value read by the firmware just prior to sending the message. I want to use this clock value to show an accurate timestamp relative to the previous packet.
For example, if my clock rate is 1 MHz, the time of arrival of the first packet is 1.0 seconds, the clock value of the first packet is 0, and the clock value of the second packet is 1000 (1 millisecond later), then I want the timestamp of the second packet to be 1.001. Is this possible? Or do I have to add a new field to my protocol which shows this clock-accurate timestamp?