Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] basic question

Date Prev · Date Next · Thread Prev · Thread Next
From: Brian Oleksa <oleksab@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 01 Nov 2010 09:16:26 -0400

Wiresharkers

I have the following code (which works perfect):

                    msecs_since_the_epoch = tvb_get_ntoh64(tvb, offset);
                    t.secs = msecs_since_the_epoch / 1000;
t.nsecs = (msecs_since_the_epoch % 1000)*1000000; /* milliseconds to nanoseconds */ proto_tree_add_time(test_sub_tree, hf_test_time, tvb, offset, 8, &t);
                    offset += 8;

        { &hf_test_time,
{ "Time", "test.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
                NULL, HFILL}},

But now the size of the time field is changing from 8 to 4. Will this work if I just change the size and offset from 8 to 4..??

                    msecs_since_the_epoch = tvb_get_ntoh64(tvb, offset);
                    t.secs = msecs_since_the_epoch / 1000;
t.nsecs = (msecs_since_the_epoch % 1000)*1000000; /* milliseconds to nanoseconds */ proto_tree_add_time(test_sub_tree, hf_test_time, tvb, offset, 4, &t);
                    offset += 4;

        { &hf_test_time,
{ "Time", "test.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
                NULL, HFILL}},

Or do I have to adjust for some other things..??

Thanks,
Brian