From 927b7da34668bc9c0b2dd4c339e45278fd109c77 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 21 May 2010 06:33:25 +0000 Subject: Have abs_time_to_str() and abs_time_to_str_secs() take an additional argument indicating whether to include the time zone in the string. If we're constructing a display filter, don't include the time zone, otherwise do. Fixes bug 4756. svn path=/trunk/; revision=32913 --- epan/dissectors/packet-ccsds.c | 2 +- epan/dissectors/packet-collectd.c | 2 +- epan/dissectors/packet-dhcp-failover.c | 16 ++--- epan/dissectors/packet-dhcpv6.c | 2 +- epan/dissectors/packet-dmp.c | 10 +-- epan/dissectors/packet-dnp.c | 10 +-- epan/dissectors/packet-dns.c | 11 ++-- epan/dissectors/packet-dtn.c | 6 +- epan/dissectors/packet-goose.c | 2 +- epan/dissectors/packet-icq.c | 2 +- epan/dissectors/packet-ipmi.c | 2 +- epan/dissectors/packet-ipp.c | 2 +- epan/dissectors/packet-kink.c | 4 +- epan/dissectors/packet-kismet.c | 2 +- epan/dissectors/packet-mms.c | 4 +- epan/dissectors/packet-mmse.c | 3 +- epan/dissectors/packet-ncp2222.inc | 44 ++++++------- epan/dissectors/packet-pktc.c | 2 +- epan/dissectors/packet-radius.c | 2 +- epan/dissectors/packet-snmp.c | 2 +- epan/dissectors/packet-time.c | 2 +- epan/dissectors/packet-vcdu.c | 2 +- epan/dissectors/packet-wsp.c | 10 +-- epan/ftypes/ftype-time.c | 7 ++- epan/proto.c | 4 +- epan/to_str.c | 110 +++++++++++++++++++++++---------- epan/to_str.h | 6 +- epan/wslua/wslua_util.c | 2 +- 28 files changed, 161 insertions(+), 112 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index a3f2b59378..72f8375e0b 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -264,7 +264,7 @@ static const char* embedded_time_to_string ( int coarse_time, int fine_time ) fraction = ( multiplier * ( (int)fine_time & 0xff ) ) / 256; t.nsecs = fraction*1000000; /* msecs to nsecs */ - return abs_time_to_str(&t, ABSOLUTE_TIME_DOY_UTC); + return abs_time_to_str(&t, ABSOLUTE_TIME_DOY_UTC, TRUE); } diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c index 649d6cb35b..a20eb2d6d5 100644 --- a/epan/dissectors/packet-collectd.c +++ b/epan/dissectors/packet-collectd.c @@ -1107,7 +1107,7 @@ dissect_collectd (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pkt_errors++; else { - vdispatch.time_str = abs_time_secs_to_str ((time_t) vdispatch.time, ABSOLUTE_TIME_LOCAL); + vdispatch.time_str = abs_time_secs_to_str ((time_t) vdispatch.time, ABSOLUTE_TIME_LOCAL, TRUE); ndispatch.time = vdispatch.time; ndispatch.time_str = vdispatch.time_str; diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c index 18432e641e..b1d51cf11d 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -444,7 +444,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) timex.nsecs = 0; proto_tree_add_time_format_value(dhcpfo_tree, hf_dhcpfo_time, tvb, offset, 4, &timex, "%s", - abs_time_secs_to_str(timex.secs, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(timex.secs, ABSOLUTE_TIME_LOCAL, TRUE)); } offset += 4; @@ -667,7 +667,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) lease_expiration_time = tvb_get_ntohl(tvb, offset); lease_expiration_time_str = - abs_time_secs_to_str(lease_expiration_time, ABSOLUTE_TIME_LOCAL); + abs_time_secs_to_str(lease_expiration_time, ABSOLUTE_TIME_LOCAL, TRUE); proto_item_append_text(oi, ", %s", lease_expiration_time_str); @@ -691,7 +691,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_get_ntohl(tvb, offset); potential_expiration_time_str = - abs_time_secs_to_str(potential_expiration_time, ABSOLUTE_TIME_LOCAL); + abs_time_secs_to_str(potential_expiration_time, ABSOLUTE_TIME_LOCAL, TRUE); proto_item_append_text(oi, ", %s", potential_expiration_time_str); @@ -715,7 +715,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb_get_ntohl(tvb, offset); grace_expiration_time_str = - abs_time_secs_to_str(grace_expiration_time, ABSOLUTE_TIME_LOCAL); + abs_time_secs_to_str(grace_expiration_time, ABSOLUTE_TIME_LOCAL, TRUE); proto_item_append_text(oi, ", %s", grace_expiration_time_str); @@ -738,7 +738,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) client_last_transaction_time = tvb_get_ntohl(tvb, offset); client_last_transaction_time_str = - abs_time_secs_to_str(client_last_transaction_time, ABSOLUTE_TIME_LOCAL); + abs_time_secs_to_str(client_last_transaction_time, ABSOLUTE_TIME_LOCAL, TRUE); proto_item_append_text(oi, ", %s", client_last_transaction_time_str); @@ -748,7 +748,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset, option_length, client_last_transaction_time, "%s", - abs_time_secs_to_str(client_last_transaction_time, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(client_last_transaction_time, ABSOLUTE_TIME_LOCAL, TRUE)); break; case DHCP_FO_PD_START_TIME_OF_STATE: @@ -761,7 +761,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) start_time_of_state = tvb_get_ntohl(tvb, offset); start_time_of_state_str = - abs_time_secs_to_str(start_time_of_state, ABSOLUTE_TIME_LOCAL); + abs_time_secs_to_str(start_time_of_state, ABSOLUTE_TIME_LOCAL, TRUE); proto_item_append_text(oi, ", %s", start_time_of_state_str); @@ -771,7 +771,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset, option_length, start_time_of_state, "%s", - abs_time_secs_to_str(start_time_of_state, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(start_time_of_state, ABSOLUTE_TIME_LOCAL, TRUE)); break; case DHCP_FO_PD_SERVERSTATE: diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index bf57278f99..a6be1191f1 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -1127,7 +1127,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, /* XXX seconds since Jan 1 2000 */ proto_tree_add_text(subtree, tvb, off + 4, 4, "Time: %s", - abs_time_secs_to_str(tvb_get_ntohl(tvb, off + 4)+630822816U, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(tvb_get_ntohl(tvb, off + 4)+630822816U, ABSOLUTE_TIME_LOCAL, TRUE)); if (optlen > 8) { proto_tree_add_text(subtree, tvb, off + 8, optlen - 8, "Link-layer address: %s", diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index c6048ca2d4..45818d8908 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -2498,7 +2498,7 @@ static gint dissect_dmp_envelope (tvbuff_t *tvb, packet_info *pinfo, "Submission time: %s", (subm_time & 0x7FFF) >= 0x7FF8 ? "Reserved" : - abs_time_secs_to_str (dmp.subm_time, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str (dmp.subm_time, ABSOLUTE_TIME_LOCAL, TRUE)); field_tree = proto_item_add_subtree (tf, ett_envelope_subm_time); proto_tree_add_item (field_tree, hf_envelope_time_diff_present, tvb, offset, 2, FALSE); @@ -3357,7 +3357,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text (tf, "Reserved (0x%2.2x)", exp_time); } else { proto_item_append_text (tf, "%s (%s)", time_secs_to_str (secs), - abs_time_secs_to_str (dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str (dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL, TRUE)); } offset += 1; } @@ -3380,13 +3380,13 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, proto_item_append_text (tf, "0 minutes in the %s (%s)", (dtg & 0x80) ? dtg_sign.true_string : dtg_sign.false_string, - abs_time_secs_to_str (dmp.subm_time, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str (dmp.subm_time, ABSOLUTE_TIME_LOCAL, TRUE)); } else { proto_item_append_text (tf, "%s in the %s (%s)", time_secs_to_str(secs), (dtg & 0x80) ? dtg_sign.true_string : dtg_sign.false_string, (dtg & 0x80) ? - abs_time_secs_to_str (dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL) : - abs_time_secs_to_str (dmp.subm_time - secs, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str (dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL, TRUE) : + abs_time_secs_to_str (dmp.subm_time - secs, ABSOLUTE_TIME_LOCAL, TRUE)); } offset += 1; } diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index d719f37297..a644818319 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -1568,7 +1568,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree data_pos += 6; al_bit = (al_ptflags & AL_OBJ_BI_FLAG7) >> 7; /* bit shift 1xxxxxxx -> xxxxxxx1 */ - proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL, TRUE)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1588,7 +1588,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree data_pos += 6; al_2bit = (al_ptflags >> 6) & 3; /* bit shift 11xxxxxx -> 00000011 */ - proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_2bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_2bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL, TRUE)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1611,7 +1611,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree data_pos += 2; al_bit = (al_ptflags & AL_OBJ_BI_FLAG7) >> 7; /* bit shift 1xxxxxxx -> xxxxxxx1 */ - proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL, TRUE)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1835,7 +1835,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree case AL_OBJ_FDCTRC_32T: case AL_OBJ_FDCTRC_16T: dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL, TRUE)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -1942,7 +1942,7 @@ dnp3_al_process_object(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree case AL_OBJ_AIFC_FLTT: case AL_OBJ_AIFC_DBLT: dnp3_al_get_timestamp(&al_abstime, tvb, data_pos); - proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL, TRUE)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 79d9aa8ba7..cd7db251ef 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -1546,7 +1546,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, nstime.secs = tvb_get_ntohl(tvb, cur_offset); nstime.nsecs = 0; proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s", - abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE)); cur_offset += 4; rr_len -= 4; @@ -1555,7 +1555,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, nstime.secs = tvb_get_ntohl(tvb, cur_offset); nstime.nsecs = 0; proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Time signed: %s", - abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE)); cur_offset += 4; rr_len -= 4; @@ -2190,7 +2190,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, nstime.secs = tvb_get_ntohl(tvb, cur_offset); nstime.nsecs = 0; proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature inception: %s", - abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE)); cur_offset += 4; rr_len -= 4; @@ -2199,7 +2199,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, nstime.secs = tvb_get_ntohl(tvb, cur_offset); nstime.nsecs = 0; proto_tree_add_text(rr_tree, tvb, cur_offset, 4, "Signature expiration: %s", - abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE)); cur_offset += 4; rr_len -= 4; @@ -2317,7 +2317,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, nstime.secs = tsig_timelo; nstime.nsecs = 0; proto_tree_add_text(rr_tree, tvb, cur_offset, 6, "Time signed: %s%s", - abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL), tsig_timehi == 0 ? "" : "(high bits set)"); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL, TRUE), + tsig_timehi == 0 ? "" : "(high bits set)"); cur_offset += 6; rr_len -= 6; diff --git a/epan/dissectors/packet-dtn.c b/epan/dissectors/packet-dtn.c index 0a5f7704ad..35da151088 100644 --- a/epan/dissectors/packet-dtn.c +++ b/epan/dissectors/packet-dtn.c @@ -1285,7 +1285,7 @@ dissect_version_5_primary_header(packet_info *pinfo, return 0; } time_since_2000 = (time_t) (timestamp + 946684800); - time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL); + time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL, TRUE); proto_item_set_text(timestamp_item, "Timestamp: 0x%x [%s]", timestamp, time_string); offset += sdnv_length; @@ -2090,7 +2090,7 @@ add_dtn_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_id return 0; } time_since_2000 = (time_t) (sdnv_value + 946684800); - time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL); + time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL, TRUE); proto_tree_add_text(tree, tvb, offset, sdnv_length, "%s (sec): %d [%s]", field_id, sdnv_value, time_string); offset += sdnv_length; @@ -2121,7 +2121,7 @@ add_sdnv_time_to_tree(proto_tree *tree, tvbuff_t *tvb, int offset, char *field_i return 0; } time_since_2000 = (time_t) (sdnv_value + 946684800); - time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL); + time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL, TRUE); proto_tree_add_text(tree, tvb, offset, sdnv_length, "%s: %d [%s]", field_id, sdnv_value, time_string); return sdnv_length; diff --git a/epan/dissectors/packet-goose.c b/epan/dissectors/packet-goose.c index 42fe663483..0771fd3799 100644 --- a/epan/dissectors/packet-goose.c +++ b/epan/dissectors/packet-goose.c @@ -504,7 +504,7 @@ dissect_goose_UtcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ ts.secs = seconds; ts.nsecs = nanoseconds; - ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC); + ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) { diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c index 87b77fa46b..b3c62504bd 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -954,7 +954,7 @@ icqv5_cmd_login(proto_tree* tree, tvbuff_t *tvb, int offset, int size) ti = proto_tree_add_text(tree, tvb, offset, size, "Body"); subtree = proto_item_add_subtree(ti, ett_icq_body); theTime = tvb_get_letohl(tvb, offset + CMD_LOGIN_TIME); - aTime = abs_time_secs_to_str(theTime, ABSOLUTE_TIME_LOCAL); + aTime = abs_time_secs_to_str(theTime, ABSOLUTE_TIME_LOCAL, TRUE); proto_tree_add_text(subtree, tvb, offset + CMD_LOGIN_TIME, 4, "Time: %ld = %s", (long)theTime, aTime); port = tvb_get_letohl(tvb, offset + CMD_LOGIN_PORT); diff --git a/epan/dissectors/packet-ipmi.c b/epan/dissectors/packet-ipmi.c index 08767b3628..35929e3e1d 100644 --- a/epan/dissectors/packet-ipmi.c +++ b/epan/dissectors/packet-ipmi.c @@ -774,7 +774,7 @@ ipmi_add_timestamp(proto_tree *tree, gint hf, tvbuff_t *tvb, guint offset) time_secs_to_str_unsigned(ts)); } else { proto_tree_add_uint_format_value(tree, hf, tvb, offset, 4, - ts, "%s", abs_time_secs_to_str(ts, ABSOLUTE_TIME_UTC)); + ts, "%s", abs_time_secs_to_str(ts, ABSOLUTE_TIME_UTC, TRUE)); } } diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c index b25f50857c..1729a52b79 100644 --- a/epan/dissectors/packet-ipp.c +++ b/epan/dissectors/packet-ipp.c @@ -507,7 +507,7 @@ add_integer_tree(proto_tree *tree, tvbuff_t *tvb, int offset, 1 + 2 + name_length + 2 + value_length, "%s: %s", format_text(name_val, name_length), - abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), ABSOLUTE_TIME_LOCAL, TRUE)); } else if((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2, "printer-state", 13)){ diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c index 3609b0bf07..8182f11ddb 100644 --- a/epan/dissectors/packet-kink.c +++ b/epan/dissectors/packet-kink.c @@ -355,7 +355,7 @@ dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto /* Show time as UTC, not local time. */ timer = tvb_get_ntohl(tvb, offset); proto_tree_add_text(payload_kink_ap_req_tree, tvb, offset, 4, "EPOCH: %s", - abs_time_secs_to_str(timer, ABSOLUTE_TIME_UTC)); + abs_time_secs_to_str(timer, ABSOLUTE_TIME_UTC, TRUE)); offset += 4; if(payload_length > PAYLOAD_HEADER){ @@ -417,7 +417,7 @@ dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto /* Show time as UTC, not local time. */ timer = tvb_get_ntohl(tvb, offset); proto_tree_add_text(payload_kink_ap_rep_tree, tvb, offset, 4, "EPOCH: %s", - abs_time_secs_to_str(timer, ABSOLUTE_TIME_UTC)); + abs_time_secs_to_str(timer, ABSOLUTE_TIME_UTC, TRUE)); offset += 4; if(payload_length > PAYLOAD_HEADER){ diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index 792c176c59..3934ffafd9 100644 --- a/epan/dissectors/packet-kismet.c +++ b/epan/dissectors/packet-kismet.c @@ -249,7 +249,7 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* * Format ascii representaion of time */ - ptr = abs_time_secs_to_str(t, ABSOLUTE_TIME_LOCAL); + ptr = abs_time_secs_to_str(t, ABSOLUTE_TIME_LOCAL, TRUE); proto_tree_add_text(reqresp_tree, tvb, offset, tokenlen, "Time: %s", ptr); } diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c index 70df08041b..3459dcb1a1 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -1865,7 +1865,7 @@ dissect_mms_TimeOfDay(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ ts.secs = (days + 5113) * 86400 + milliseconds / 1000; ts.nsecs = (milliseconds % 1000) * G_GINT64_CONSTANT(1000000U); - ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC); + ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); @@ -1948,7 +1948,7 @@ dissect_mms_UtcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ ts.secs = seconds; ts.nsecs = nanoseconds; - ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC); + ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) { diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index f021302eac..10b45617d3 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -1207,7 +1207,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, &count2); tmptime.secs = tval; tmptime.nsecs = 0; - strval = abs_time_to_str(&tmptime, ABSOLUTE_TIME_LOCAL); + strval = abs_time_to_str(&tmptime, ABSOLUTE_TIME_LOCAL, + TRUE); /* Now render the fields */ tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); tii = proto_tree_add_string_format(mmse_tree, diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index 44349c9217..a7bcda6979 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -3363,7 +3363,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val voffset = voffset+4; ns.secs = tvb_get_letohl(tvb, voffset); ns.nsecs = 0; - proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); voffset = voffset + 4; rnum = tvb_get_letohs(tvb, voffset); /* replica number */ proto_tree_add_uint_format(nvtree, hf_nds_rnum, tvb, voffset, @@ -3397,7 +3397,7 @@ print_nds_values(proto_tree *vtree, tvbuff_t *tvb, guint32 syntax_type, nds_val voffset += 4; /* This is the length of the time data no need to decode, always 4 bytes */ ns.secs = tvb_get_letohl(tvb, voffset); ns.nsecs = 0; - proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); voffset = voffset + 4; break; case 0x00000019: /* Typed Name */ @@ -3612,7 +3612,7 @@ print_es_type(proto_tree *estree, tvbuff_t *tvb, nds_val *values, guint32 vtype, ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(nestree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(nestree, hf_nds_replica_num, tvb, ioffset, @@ -3697,7 +3697,7 @@ print_es_type(proto_tree *estree, tvbuff_t *tvb, nds_val *values, guint32 vtype, ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(estree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, @@ -3844,7 +3844,7 @@ print_es_type(proto_tree *estree, tvbuff_t *tvb, nds_val *values, guint32 vtype, ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(estree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, @@ -3895,7 +3895,7 @@ print_es_type(proto_tree *estree, tvbuff_t *tvb, nds_val *values, guint32 vtype, ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(sub2tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub2tree, hf_nds_replica_num, tvb, ioffset, @@ -4443,14 +4443,14 @@ process_entry_info(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values) ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(it_tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; } if (iter_flags & DSI_MODIFICATION_TIMESTAMP) { /* Modification Timestamp */ ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(it_tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(it_tree, hf_nds_replica_num, tvb, ioffset, @@ -4465,7 +4465,7 @@ process_entry_info(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values) ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(it_tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(it_tree, hf_nds_replica_num, tvb, ioffset, @@ -4567,7 +4567,7 @@ process_entry_info(proto_tree *it_tree, tvbuff_t *tvb, nds_val *values) ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(it_tree, hf_nds_purge, tvb, ioffset, - 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; } if (iter_flags & DSI_DEREFERENCED_BASE_CLASS) { /* Dereference Base Class */ @@ -5178,7 +5178,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(atree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(atree, hf_nds_replica_num, tvb, ioffset, @@ -5270,7 +5270,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Creation Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Creation Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -5412,7 +5412,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -5427,7 +5427,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_nds_purge, tvb, ioffset, - 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; break; case 0x00000020: /*p3values.bit6 = "Local Partition ID"*/ @@ -5887,14 +5887,14 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; break; case 0x0000020: /* Modification Timestamp */ ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -5909,7 +5909,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -6002,7 +6002,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; break; case 0x00020000: /* Dereference Base Class */ @@ -6266,7 +6266,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(sub1tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset, @@ -6279,7 +6279,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(sub1tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset, @@ -6499,7 +6499,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(ntree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset += 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -6535,7 +6535,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds ns.secs = tvb_get_letohl(tvb, ioffset); /* Seconds */ ns.nsecs = 0; proto_tree_add_time_format(sub2tree, hf_es_seconds, tvb, ioffset, - 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL, TRUE)); ioffset += 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub2tree, hf_nds_replica_num, tvb, ioffset, diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c index ee2460984a..b8db1c0fee 100644 --- a/epan/dissectors/packet-pktc.c +++ b/epan/dissectors/packet-pktc.c @@ -517,7 +517,7 @@ dissect_pktc_mtafqdn_krbsafeuserdata(packet_info *pinfo, tvbuff_t *tvb, proto_tr proto_tree_add_time_format(tree, hf_pktc_mtafqdn_manu_cert_revoked, tvb, offset, 4, &ts, "%s: %s", proto_registrar_get_name(hf_pktc_mtafqdn_manu_cert_revoked), - (bignum==0) ? "not revoked" : abs_time_secs_to_str(bignum, ABSOLUTE_TIME_LOCAL)); + (bignum==0) ? "not revoked" : abs_time_secs_to_str(bignum, ABSOLUTE_TIME_LOCAL, TRUE)); break; case PKTC_MTAFQDN_REP: diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 5245e5e79c..0605bffda9 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -709,7 +709,7 @@ void radius_date(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_ time_ptr.nsecs = 0; proto_tree_add_time(tree, a->hf, tvb, offset, len, &time_ptr); - proto_item_append_text(avp_item, "%s", abs_time_to_str(&time_ptr, ABSOLUTE_TIME_LOCAL)); + proto_item_append_text(avp_item, "%s", abs_time_to_str(&time_ptr, ABSOLUTE_TIME_LOCAL, TRUE)); } void radius_abinary(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) { diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index 5390a10c5b..dc19fcb105 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -1137,7 +1137,7 @@ int dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len) ts.nsecs = 0; proto_tree_add_time_format_value(tree, hf_snmp_engineid_time, tvb, offset+4, 4, &ts, "%s", - abs_time_secs_to_str(seconds, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(seconds, ABSOLUTE_TIME_LOCAL, TRUE)); offset+=8; len_remain=0; } diff --git a/epan/dissectors/packet-time.c b/epan/dissectors/packet-time.c index 771b3965e9..d2b4582a43 100644 --- a/epan/dissectors/packet-time.c +++ b/epan/dissectors/packet-time.c @@ -65,7 +65,7 @@ dissect_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 delta_seconds = tvb_get_ntohl(tvb, 0); proto_tree_add_uint_format(time_tree, hf_time_time, tvb, 0, 4, delta_seconds, "%s", - abs_time_secs_to_str(delta_seconds-2208988800U, ABSOLUTE_TIME_LOCAL)); + abs_time_secs_to_str(delta_seconds-2208988800U, ABSOLUTE_TIME_LOCAL, TRUE)); } } } diff --git a/epan/dissectors/packet-vcdu.c b/epan/dissectors/packet-vcdu.c index 1f838a0530..20b907f25f 100644 --- a/epan/dissectors/packet-vcdu.c +++ b/epan/dissectors/packet-vcdu.c @@ -195,7 +195,7 @@ static const char* smex_time_to_string ( int pb5_days_since_midnight_9_10_oct_19 t.secs = ( pb5_days_since_midnight_9_10_oct_1995 * 86400 ) + pb5_seconds + utcdiff; t.nsecs = pb5_milliseconds*1000000; /* msecs to nsecs */ - return abs_time_to_str(&t, ABSOLUTE_TIME_DOY_UTC); + return abs_time_to_str(&t, ABSOLUTE_TIME_DOY_UTC, TRUE); } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index 25a1596bdc..5960a57732 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -1797,7 +1797,7 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) tvb, hdr_start, hdr_len + val_len, "Requesting Time Of Day"); } else { - val_str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); + val_str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); ti = proto_tree_add_string (wsp_headers, hf_hdr_x_wap_tod, tvb, hdr_start, hdr_len + val_len, val_str); @@ -2832,7 +2832,7 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i if (val_id <= 4) { /* Length field already parsed by macro! */ \ get_date_value(val, tvb, off, len, ok); \ if (ok) { \ - str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); \ + str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); \ tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ @@ -2867,7 +2867,7 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i if (val_id <= 4) { /* Length field already parsed by macro! */ \ get_date_value(val, tvb, off, len, ok); \ if (ok) { \ - str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); \ + str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); \ tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ @@ -2920,7 +2920,7 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i tvb, hdr_start, offset - hdr_start, \ "Requesting Time Of Day"); \ } else { \ - str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); \ + str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); \ tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ @@ -3590,7 +3590,7 @@ wkh_profile_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i get_date_value(val, tvb, off, len, ok); if (ok) { /* Valid warn-text string */ off += len; - val_str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); + val_str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL, TRUE); str = g_strdup_printf("; date=%s", val_str); proto_item_append_string(ti, str); g_free(str); /* proto_XXX creates a copy */ diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index 75436cbb35..fd81266722 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -319,14 +319,17 @@ absolute_val_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { gchar *rep; - rep = abs_time_to_str(&fv->value.time, ABSOLUTE_TIME_LOCAL); + rep = abs_time_to_str(&fv->value.time, ABSOLUTE_TIME_LOCAL, + rtype == FTREPR_DISPLAY); return (int)strlen(rep) + 2; /* 2 for opening and closing quotes */ } static void absolute_val_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf) { - sprintf(buf, "\"%s\"", abs_time_to_str(&fv->value.time, ABSOLUTE_TIME_LOCAL)); + sprintf(buf, "\"%s\"", + abs_time_to_str(&fv->value.time, ABSOLUTE_TIME_LOCAL, + rtype == FTREPR_DISPLAY)); } static int diff --git a/epan/proto.c b/epan/proto.c index b6a418bc7c..1c90609c0d 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -3392,7 +3392,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gchar *result, case FT_ABSOLUTE_TIME: g_strlcpy(result, - abs_time_to_str(fvalue_get(&finfo->value), hfinfo->display), + abs_time_to_str(fvalue_get(&finfo->value), hfinfo->display, TRUE), size); break; @@ -4636,7 +4636,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str) case FT_ABSOLUTE_TIME: g_snprintf(label_str, ITEM_LABEL_LENGTH, "%s: %s", hfinfo->name, - abs_time_to_str(fvalue_get(&fi->value), hfinfo->display)); + abs_time_to_str(fvalue_get(&fi->value), hfinfo->display, TRUE)); break; case FT_RELATIVE_TIME: diff --git a/epan/to_str.c b/epan/to_str.c index f25ff992ad..5ad81d14ea 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -473,7 +473,8 @@ static const char *mon_names[12] = { }; gchar * -abs_time_to_str(const nstime_t *abs_time, const absolute_time_display_e fmt) +abs_time_to_str(const nstime_t *abs_time, const absolute_time_display_e fmt, + gboolean show_zone) { struct tm *tmp = NULL; const char *zonename = "???"; @@ -514,27 +515,48 @@ abs_time_to_str(const nstime_t *abs_time, const absolute_time_display_e fmt) switch (fmt) { case ABSOLUTE_TIME_DOY_UTC: - buf = ep_strdup_printf("%04d/%03d:%02d:%02d:%02d.%09ld %s", - tmp->tm_year + 1900, - tmp->tm_yday, - tmp->tm_hour, - tmp->tm_min, - tmp->tm_sec, - (long)abs_time->nsecs, - zonename); + if (show_zone) { + buf = ep_strdup_printf("%04d/%03d:%02d:%02d:%02d.%09ld %s", + tmp->tm_year + 1900, + tmp->tm_yday, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec, + (long)abs_time->nsecs, + zonename); + } else { + buf = ep_strdup_printf("%04d/%03d:%02d:%02d:%02d.%09ld", + tmp->tm_year + 1900, + tmp->tm_yday, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec, + (long)abs_time->nsecs); + } break; case ABSOLUTE_TIME_UTC: case ABSOLUTE_TIME_LOCAL: - buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d.%09ld %s", - mon_names[tmp->tm_mon], - tmp->tm_mday, - tmp->tm_year + 1900, - tmp->tm_hour, - tmp->tm_min, - tmp->tm_sec, - (long)abs_time->nsecs, - zonename); + if (show_zone) { + buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d.%09ld %s", + mon_names[tmp->tm_mon], + tmp->tm_mday, + tmp->tm_year + 1900, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec, + (long)abs_time->nsecs, + zonename); + } else { + buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d.%09ld", + mon_names[tmp->tm_mon], + tmp->tm_mday, + tmp->tm_year + 1900, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec, + (long)abs_time->nsecs); + } break; } } else @@ -543,7 +565,8 @@ abs_time_to_str(const nstime_t *abs_time, const absolute_time_display_e fmt) } gchar * -abs_time_secs_to_str(const time_t abs_time, const absolute_time_display_e fmt) +abs_time_secs_to_str(const time_t abs_time, const absolute_time_display_e fmt, + gboolean show_zone) { struct tm *tmp = NULL; const char *zonename = "???"; @@ -584,25 +607,44 @@ abs_time_secs_to_str(const time_t abs_time, const absolute_time_display_e fmt) switch (fmt) { case ABSOLUTE_TIME_DOY_UTC: - buf = ep_strdup_printf("%04d/%03d:%02d:%02d:%02d %s", - tmp->tm_year + 1900, - tmp->tm_yday, - tmp->tm_hour, - tmp->tm_min, - tmp->tm_sec, - zonename); + if (show_zone) { + buf = ep_strdup_printf("%04d/%03d:%02d:%02d:%02d %s", + tmp->tm_year + 1900, + tmp->tm_yday, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec, + zonename); + } else { + buf = ep_strdup_printf("%04d/%03d:%02d:%02d:%02d", + tmp->tm_year + 1900, + tmp->tm_yday, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec); + } break; case ABSOLUTE_TIME_UTC: case ABSOLUTE_TIME_LOCAL: - buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d %s", - mon_names[tmp->tm_mon], - tmp->tm_mday, - tmp->tm_year + 1900, - tmp->tm_hour, - tmp->tm_min, - tmp->tm_sec, - zonename); + if (show_zone) { + buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d %s", + mon_names[tmp->tm_mon], + tmp->tm_mday, + tmp->tm_year + 1900, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec, + zonename); + } else { + buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d", + mon_names[tmp->tm_mon], + tmp->tm_mday, + tmp->tm_year + 1900, + tmp->tm_hour, + tmp->tm_min, + tmp->tm_sec); + } break; } } else diff --git a/epan/to_str.h b/epan/to_str.h index ab42c03ade..d1bb65f47c 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -62,8 +62,10 @@ extern gchar* vines_addr_to_str(const guint8 *addrp); extern gchar* time_secs_to_str(const gint32 time_val); extern gchar* time_secs_to_str_unsigned(const guint32); extern gchar* time_msecs_to_str(gint32 time_val); -extern gchar* abs_time_to_str(const nstime_t*, const absolute_time_display_e fmt); -extern gchar* abs_time_secs_to_str(const time_t, const absolute_time_display_e fmt); +extern gchar* abs_time_to_str(const nstime_t*, const absolute_time_display_e fmt, + gboolean show_zone); +extern gchar* abs_time_secs_to_str(const time_t, const absolute_time_display_e fmt, + gboolean show_zone); extern void display_signed_time(gchar *, int, const gint32, gint32, const to_str_time_res_t); extern void display_epoch_time(gchar *, int, const time_t, gint32, const to_str_time_res_t); diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c index ab6a6d33c2..96840653de 100644 --- a/epan/wslua/wslua_util.c +++ b/epan/wslua/wslua_util.c @@ -70,7 +70,7 @@ WSLUA_FUNCTION wslua_format_date(lua_State* LS) { /* Formats an absolute timesta then.secs = (guint32)floor(timestamp); then.nsecs = (guint32) ( (timestamp-(double)(then.secs))*1000000000); - str = abs_time_to_str(&then, ABSOLUTE_TIME_LOCAL); + str = abs_time_to_str(&then, ABSOLUTE_TIME_LOCAL, TRUE); lua_pushstring(LS,str); WSLUA_RETURN(1); /* A string with the formated date */ -- cgit v1.2.3