Wireshark-dev: [Wireshark-dev] nstime_t, time_t, typecasts
From: Martin Kaiser <[email protected]>
Date: Sun, 1 May 2011 15:06:04 +0200
Dear all,

I'm working on messages that contain a UTC time info. To display this in
the protocol tree as FT_ABSOLUTE_TIME, I should store the time info in
an nstime_t variable. The output then looks like

Aug 18, 2010 10:32:11.000000000

as nstime_t has nanosecond precision. Is there any chance to limit this
to seconds only (that's all my protocol uses)?

In order to populate the nstime_t, I set the seconds directly, e.g.

nstime_t my_time;
my_time.secs = tvb_get_guint8(tvb, offset);

Is this portable enough with the implicit cast between guint8 and
time_t? What about the other direction

col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL,
                    "time info is %d seconds", (int)my_time.secs); 

Is it ok to do this in wireshark or is there a more portable way?

Thanks in advance for your feedback,


P.S: I know there's a lot of work, but could anyone of the core developers
spare some minutes to commit my patch from bug #5832 ;-) ?