diff options
-rw-r--r-- | asn1/snmp/packet-snmp-template.c | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-collectd.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-dhcp-failover.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-dmp.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-dnp.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-dns.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-dtn.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-icq.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ipmi.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ipp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-kismet.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mmse.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ncp2222.inc | 44 | ||||
-rw-r--r-- | epan/dissectors/packet-pktc.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-radius.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-snmp.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-time.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-wsp.c | 41 | ||||
-rw-r--r-- | epan/ftypes/ftype-time.c | 4 | ||||
-rw-r--r-- | epan/proto.c | 4 | ||||
-rw-r--r-- | epan/to_str.c | 22 | ||||
-rw-r--r-- | epan/to_str.h | 4 | ||||
-rw-r--r-- | epan/wslua/wslua_util.c | 2 | ||||
-rw-r--r-- | print.c | 2 |
24 files changed, 107 insertions, 110 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index 3566e48065..51c1f33bc1 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -998,9 +998,10 @@ int dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len) proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, 4, FALSE); seconds = tvb_get_letohl(tvb, offset+4); ts.secs = seconds; - proto_tree_add_time_format(tree, hf_snmp_engineid_time, tvb, offset+4, 4, - &ts, "Engine ID Data: Creation Time: %s", - abs_time_secs_to_str(seconds)); + 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, FALSE)); offset+=8; len_remain=0; } @@ -1963,7 +1964,7 @@ void proto_register_snmp(void) { "Engine ID Data: Text", "snmp.engineid.text", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_snmp_engineid_time, { - "Engine ID Data: Time", "snmp.engineid.time", FT_ABSOLUTE_TIME, BASE_NONE, + "Engine ID Data: Creation Time", "snmp.engineid.time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_snmp_engineid_data, { "Engine ID Data", "snmp.engineid.data", FT_BYTES, BASE_NONE, diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c index ca1e97a80c..a219953b64 100644 --- a/epan/dissectors/packet-collectd.c +++ b/epan/dissectors/packet-collectd.c @@ -1114,7 +1114,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); + vdispatch.time_str = abs_time_secs_to_str ((time_t) vdispatch.time, FALSE); 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 2caccc1d00..a2887a700a 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -446,7 +446,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)); + abs_time_secs_to_str(timex.secs, FALSE)); } offset += 4; @@ -669,7 +669,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); + abs_time_secs_to_str(lease_expiration_time, FALSE); proto_item_append_text(oi, ", %s", lease_expiration_time_str); @@ -693,7 +693,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); + abs_time_secs_to_str(potential_expiration_time, FALSE); proto_item_append_text(oi, ", %s", potential_expiration_time_str); @@ -717,7 +717,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); + abs_time_secs_to_str(grace_expiration_time, FALSE); proto_item_append_text(oi, ", %s", grace_expiration_time_str); @@ -740,7 +740,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); + abs_time_secs_to_str(client_last_transaction_time, FALSE); proto_item_append_text(oi, ", %s", client_last_transaction_time_str); @@ -750,7 +750,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)); + abs_time_secs_to_str(client_last_transaction_time, FALSE)); break; case DHCP_FO_PD_START_TIME_OF_STATE: @@ -763,7 +763,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); + abs_time_secs_to_str(start_time_of_state, FALSE); proto_item_append_text(oi, ", %s", start_time_of_state_str); @@ -773,7 +773,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)); + abs_time_secs_to_str(start_time_of_state, FALSE)); break; case DHCP_FO_PD_SERVERSTATE: diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index 9085eee592..cd2edf3570 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)); + abs_time_secs_to_str (dmp.subm_time, FALSE)); 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)); + abs_time_secs_to_str (dmp.subm_time + secs, FALSE)); } 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)); + abs_time_secs_to_str (dmp.subm_time, FALSE)); } 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) : - abs_time_secs_to_str (dmp.subm_time - secs)); + abs_time_secs_to_str (dmp.subm_time + secs, FALSE) : + abs_time_secs_to_str (dmp.subm_time - secs, FALSE)); } offset += 1; } diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 4ad5ab83ca..0b8c5c4819 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -1567,7 +1567,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)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, FALSE)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1587,7 +1587,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)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_2bit, abs_time_to_str(&al_abstime, FALSE)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1610,7 +1610,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)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, FALSE)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1834,7 +1834,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)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, FALSE)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -1941,7 +1941,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)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, FALSE)); 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 cdfb874ef8..3000735690 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -1543,7 +1543,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)); + abs_time_to_str(&nstime, FALSE)); cur_offset += 4; rr_len -= 4; @@ -1552,7 +1552,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)); + abs_time_to_str(&nstime, FALSE)); cur_offset += 4; rr_len -= 4; @@ -2187,7 +2187,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)); + abs_time_to_str(&nstime, FALSE)); cur_offset += 4; rr_len -= 4; @@ -2196,7 +2196,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)); + abs_time_to_str(&nstime, FALSE)); cur_offset += 4; rr_len -= 4; @@ -2314,7 +2314,7 @@ 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), tsig_timehi == 0 ? "" : "(high bits set)"); + abs_time_to_str(&nstime, FALSE), 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 6d8dd5026c..0a38fd12d3 100644 --- a/epan/dissectors/packet-dtn.c +++ b/epan/dissectors/packet-dtn.c @@ -1286,7 +1286,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); + time_string = abs_time_secs_to_str(time_since_2000, FALSE); proto_item_set_text(timestamp_item, "Timestamp: 0x%x [%s]", timestamp, time_string); offset += sdnv_length; @@ -2093,7 +2093,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); + time_string = abs_time_secs_to_str(time_since_2000, FALSE); proto_tree_add_text(tree, tvb, offset, sdnv_length, "%s (sec): %d [%s]", field_id, sdnv_value, time_string); offset += sdnv_length; @@ -2124,7 +2124,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); + time_string = abs_time_secs_to_str(time_since_2000, FALSE); 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-icq.c b/epan/dissectors/packet-icq.c index 8f44498fe9..253243b507 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -957,7 +957,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); + aTime = abs_time_secs_to_str(theTime, FALSE); 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 d60554a230..6636277c97 100644 --- a/epan/dissectors/packet-ipmi.c +++ b/epan/dissectors/packet-ipmi.c @@ -781,7 +781,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)); + ts, "%s", abs_time_secs_to_str(ts, FALSE)); } } diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c index 1634b83304..bf41158122 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))); + abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), FALSE)); } else if((name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2, "printer-state", 13)){ diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index ec2e465656..e3b4bcf874 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); + ptr = abs_time_secs_to_str(t, FALSE); proto_tree_add_text(reqresp_tree, tvb, offset, tokenlen, "Time: %s", ptr); } diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index 1c978d5cfe..82f1eca7bd 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -1207,7 +1207,7 @@ 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); + strval = abs_time_to_str(&tmptime, FALSE); /* Now render the fields */ tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); ti = proto_tree_add_string_format(mmse_tree, diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index 50f6a7ce17..9dd856d024 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -3362,7 +3362,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_to_str(&ns)); + proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); voffset = voffset + 4; rnum = tvb_get_letohs(tvb, voffset); /* replica number */ proto_tree_add_uint_format(nvtree, hf_nds_rnum, tvb, voffset, @@ -3396,7 +3396,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_to_str(&ns)); + proto_tree_add_time_format(nvtree, hf_nds_ds_time, tvb, voffset, 4, &ns, "Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); voffset = voffset + 4; break; case 0x00000019: /* Typed Name */ @@ -3611,7 +3611,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_to_str(&ns)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(nestree, hf_nds_replica_num, tvb, ioffset, @@ -3696,7 +3696,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_to_str(&ns)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, @@ -3843,7 +3843,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_to_str(&ns)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(estree, hf_nds_replica_num, tvb, ioffset, @@ -3894,7 +3894,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_to_str(&ns)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub2tree, hf_nds_replica_num, tvb, ioffset, @@ -4442,14 +4442,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_to_str(&ns)); + 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); 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_to_str(&ns)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(it_tree, hf_nds_replica_num, tvb, ioffset, @@ -4464,7 +4464,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_to_str(&ns)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(it_tree, hf_nds_replica_num, tvb, ioffset, @@ -4566,7 +4566,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_to_str(&ns)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; } if (iter_flags & DSI_DEREFERENCED_BASE_CLASS) { /* Dereference Base Class */ @@ -5177,7 +5177,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_to_str(&ns)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(atree, hf_nds_replica_num, tvb, ioffset, @@ -5269,7 +5269,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_to_str(&ns)); + 4, &ns, "Creation Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -5411,7 +5411,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_to_str(&ns)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -5426,7 +5426,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_to_str(&ns)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; break; case 0x00000020: /*p3values.bit6 = "Local Partition ID"*/ @@ -5886,14 +5886,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_to_str(&ns)); + 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); 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_to_str(&ns)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -5908,7 +5908,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_to_str(&ns)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -6001,7 +6001,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_to_str(&ns)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; break; case 0x00020000: /* Dereference Base Class */ @@ -6265,7 +6265,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_to_str(&ns)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset, @@ -6278,7 +6278,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_to_str(&ns)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset = ioffset + 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(sub1tree, hf_nds_replica_num, tvb, ioffset, @@ -6498,7 +6498,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_to_str(&ns)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); ioffset += 4; replica_num = tvb_get_letohs(tvb, ioffset); /* Replica */ proto_tree_add_item(ntree, hf_nds_replica_num, tvb, ioffset, @@ -6534,7 +6534,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_to_str(&ns)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, FALSE)); 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 020f7b7f3f..ebdaaa575c 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)); + (bignum==0) ? "not revoked" : abs_time_secs_to_str(bignum, FALSE)); break; case PKTC_MTAFQDN_REP: diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 8aedcd49b3..e2e7bcbe35 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)); + proto_item_append_text(avp_item, "%s", abs_time_to_str(&time_ptr, FALSE)); } 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 47f19ab286..de910be5b9 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -1100,9 +1100,10 @@ int dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len) proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, 4, FALSE); seconds = tvb_get_letohl(tvb, offset+4); ts.secs = seconds; - proto_tree_add_time_format(tree, hf_snmp_engineid_time, tvb, offset+4, 4, - &ts, "Engine ID Data: Creation Time: %s", - abs_time_secs_to_str(seconds)); + 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, FALSE)); offset+=8; len_remain=0; } @@ -2665,7 +2666,7 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-snmp-fn.c ---*/ -#line 1445 "packet-snmp-template.c" +#line 1446 "packet-snmp-template.c" guint @@ -3187,7 +3188,7 @@ void proto_register_snmp(void) { "Engine ID Data: Text", "snmp.engineid.text", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_snmp_engineid_time, { - "Engine ID Data: Time", "snmp.engineid.time", FT_ABSOLUTE_TIME, BASE_NONE, + "Engine ID Data: Creation Time", "snmp.engineid.time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_snmp_engineid_data, { "Engine ID Data", "snmp.engineid.data", FT_BYTES, BASE_NONE, @@ -3487,7 +3488,7 @@ void proto_register_snmp(void) { "snmp.T_operation", HFILL }}, /*--- End of included file: packet-snmp-hfarr.c ---*/ -#line 2002 "packet-snmp-template.c" +#line 2003 "packet-snmp-template.c" }; /* List of subtrees */ @@ -3527,7 +3528,7 @@ void proto_register_snmp(void) { &ett_snmp_RReqPDU_U, /*--- End of included file: packet-snmp-ettarr.c ---*/ -#line 2018 "packet-snmp-template.c" +#line 2019 "packet-snmp-template.c" }; module_t *snmp_module; diff --git a/epan/dissectors/packet-time.c b/epan/dissectors/packet-time.c index ee3fefe955..ee25df4f43 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)); + abs_time_secs_to_str(delta_seconds-2208988800U, FALSE)); } } } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index 7ac858e5b7..ace4e728ee 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -1738,7 +1738,6 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) proto_item *ti, *hidden_item; guint8 ok; guint32 val = 0; - nstime_t tv; if (! tree) return; @@ -1799,9 +1798,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 { - tv.secs = val; - tv.nsecs = 0; - val_str = abs_time_to_str(&tv); + val_str = abs_time_secs_to_str(val, FALSE); ti = proto_tree_add_string (wsp_headers, hf_hdr_x_wap_tod, tvb, hdr_start, hdr_len + val_len, val_str); @@ -2834,7 +2831,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i { \ wkh_0_Declarations; \ guint32 val = 0, off = val_start, len; \ - nstime_t tv; \ gchar *str; /* may not be freed! */ \ \ wkh_1_WellKnownValue; \ @@ -2848,15 +2844,12 @@ 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) { \ - tv.secs = val; \ - tv.nsecs = 0; \ - str = abs_time_to_str(&tv); \ + str = abs_time_secs_to_str(val, FALSE); \ 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); \ - /* BEHOLD: do NOT try to free str, as this generates a core - * dump! It looks like abs_time_to_str() is buggy or works - * with static data. */ \ + /* BEHOLD: do NOT try to free str, as \ + * abs_time_secs_to_str() returns ep_allocated data */ \ } \ } \ wkh_4_End(hf_hdr_ ## underscored); \ @@ -2876,7 +2869,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i { \ wkh_0_Declarations; \ guint32 val = 0, off = val_start, len; \ - nstime_t tv; \ gchar *str; /* may not be freed! */ \ \ wkh_1_WellKnownValue; \ @@ -2887,15 +2879,12 @@ 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) { \ - tv.secs = val; \ - tv.nsecs = 0; \ - str = abs_time_to_str(&tv); \ + str = abs_time_secs_to_str(val, FALSE); \ 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); \ - /* BEHOLD: do NOT try to free str, as this generates a core - * dump! It looks like abs_time_to_str() is buggy or works - * with static data. */ \ + /* BEHOLD: do NOT try to free str, as \ + * abs_time_secs_to_str() returns ep_allocated data */ \ } \ } \ wkh_4_End(hf_hdr_ ## underscored); \ @@ -2916,7 +2905,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i { \ wkh_0_Declarations; \ guint32 val = 0, off = val_start, len; \ - nstime_t tv; \ gchar *str; /* may not be freed! */ \ \ wkh_1_WellKnownValue; \ @@ -2944,9 +2932,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 { \ - tv.secs = val; \ - tv.nsecs = 0; \ - str = abs_time_to_str(&tv); \ + str = abs_time_secs_to_str(val, FALSE); \ 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); \ @@ -3582,7 +3568,6 @@ wkh_profile_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i { wkh_0_Declarations; guint32 off, len, val = 0; - nstime_t tv; guint8 warn_code; gchar *str; @@ -3617,16 +3602,12 @@ 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; - tv.secs = val; - tv.nsecs = 0; - val_str = abs_time_to_str(&tv); + val_str = abs_time_secs_to_str(val, FALSE); str = g_strdup_printf("; date=%s", val_str); proto_item_append_string(ti, str); g_free(str); /* proto_XXX creates a copy */ - /* BEHOLD: do NOT try to free val_str, as this - * generates a core dump! - * It looks like abs_time_to_str() is - * buggy or works with static data. */ + /* BEHOLD: do NOT try to free str, as \ + * abs_time_secs_to_str() returns ep_allocated data */ \ } } } diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index 15b33d2ca9..155bac9599 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -319,14 +319,14 @@ absolute_val_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { gchar *rep; - rep = abs_time_to_str(&fv->value.time); + rep = abs_time_to_str(&fv->value.time, FALSE); 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)); + sprintf(buf, "\"%s\"", abs_time_to_str(&fv->value.time, FALSE)); } static int diff --git a/epan/proto.c b/epan/proto.c index 46d94b5951..af01ce2959 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -3334,7 +3334,7 @@ proto_custom_set(proto_tree* tree, int field_id, break; case FT_ABSOLUTE_TIME: - g_strlcpy(result, abs_time_to_str(fvalue_get(&finfo->value)), size); + g_strlcpy(result, abs_time_to_str(fvalue_get(&finfo->value), FALSE), size); break; case FT_RELATIVE_TIME: @@ -4461,7 +4461,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))); + abs_time_to_str(fvalue_get(&fi->value), FALSE)); break; case FT_RELATIVE_TIME: diff --git a/epan/to_str.c b/epan/to_str.c index 1a3e4a1646..065b9fb9d3 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -307,7 +307,7 @@ static const char *mon_names[12] = { }; gchar * -abs_time_to_str(nstime_t *abs_time) +abs_time_to_str(nstime_t *abs_time, gboolean show_as_utc) { struct tm *tmp; gchar *buf; @@ -320,7 +320,10 @@ abs_time_to_str(nstime_t *abs_time) tmp = NULL; } else #endif - tmp = localtime(&abs_time->secs); + if (show_as_utc) + tmp = gmtime(&abs_time->secs); + else + tmp = localtime(&abs_time->secs); if (tmp) { buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d.%09ld", mon_names[tmp->tm_mon], @@ -336,12 +339,23 @@ abs_time_to_str(nstime_t *abs_time) } gchar * -abs_time_secs_to_str(time_t abs_time) +abs_time_secs_to_str(time_t abs_time, gboolean show_as_utc) { struct tm *tmp; gchar *buf; - tmp = localtime(&abs_time); +#ifdef _MSC_VER + /* calling localtime() on MSVC 2005 with huge values causes it to crash */ + /* XXX - find the exact value that still does work */ + /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ + if(abs_time > 2000000000) { + tmp = NULL; + } else +#endif + if (show_as_utc) + tmp = gmtime(&abs_time); + else + tmp = localtime(&abs_time); if (tmp) { buf = ep_strdup_printf("%s %2d, %d %02d:%02d:%02d", mon_names[tmp->tm_mon], diff --git a/epan/to_str.h b/epan/to_str.h index 69d02a357c..a606c620f3 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -74,8 +74,8 @@ extern void vines_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len); extern gchar* time_secs_to_str(gint32); extern gchar* time_secs_to_str_unsigned(guint32); extern gchar* time_msecs_to_str(gint32); -extern gchar* abs_time_to_str(nstime_t*); -extern gchar* abs_time_secs_to_str(time_t); +extern gchar* abs_time_to_str(nstime_t*, gboolean); +extern gchar* abs_time_secs_to_str(time_t, gboolean); extern void display_signed_time(gchar *, int, gint32, gint32, time_res_t); extern void display_epoch_time(gchar *, int, time_t, gint32, time_res_t); diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c index 05fe37ebae..eb426feadf 100644 --- a/epan/wslua/wslua_util.c +++ b/epan/wslua/wslua_util.c @@ -64,7 +64,7 @@ WSLUA_FUNCTION wslua_format_date(lua_State* LS) { /* Formats an absolute timesta then.secs = (guint32)floor(time); then.nsecs = (guint32) ( (time-(double)(then.secs))*1000000000); - str = abs_time_to_str(&then); + str = abs_time_to_str(&then, FALSE); lua_pushstring(LS,str); WSLUA_RETURN(1); /* A string with the formated date */ @@ -550,7 +550,7 @@ print_pdml_geninfo(proto_tree *tree, FILE *fh) /* Print geninfo.timestamp */ fprintf(fh, " <field name=\"timestamp\" pos=\"0\" show=\"%s\" showname=\"Captured Time\" value=\"%d.%09d\" size=\"%u\"/>\n", - abs_time_to_str(timestamp), (int) timestamp->secs, timestamp->nsecs, frame_finfo->length); + abs_time_to_str(timestamp, FALSE), (int) timestamp->secs, timestamp->nsecs, frame_finfo->length); /* Print geninfo end */ fprintf(fh, |