diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-02-27 19:01:27 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-02-27 19:01:27 +0000 |
commit | 500eb99cd9ae9503344998b811e4856a2bb6bfb2 (patch) | |
tree | f1ed4387361e37904198aac2f5e80833d74011b0 /epan/dissectors | |
parent | 9dd11bb90eb4bca3f03f0f547da9be901a56f996 (diff) |
Add a third date format, ABSOLUTE_TIME_DOY_UTC, to show UTC with the
date as YYYY/DDD, where DDD is a 1-origin day of year. Move the formats
to a "time_fmt.h" file, included by the headers that use it. Have
abs_time_to_str() and abs_time_secs_to_str() take the date format value,
rather than a Boolean "show this as UTC" flag, as an argument. Document
the ABSOLUTE_TIME_ formats a bit better. Use that format in the CCSDS
and VCDU dissectors, rather than having those dissectors do the
formatting themselves.
svn path=/trunk/; revision=32034
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-ccsds.c | 69 | ||||
-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-goose.c | 2 | ||||
-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-kink.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-kismet.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mms.c | 4 | ||||
-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 | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-time.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-vcdu.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-wsp.c | 10 |
22 files changed, 79 insertions, 144 deletions
diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c index 642dd1d564..b3ea7477b8 100644 --- a/epan/dissectors/packet-ccsds.c +++ b/epan/dissectors/packet-ccsds.c @@ -237,66 +237,13 @@ static const value_string ccsds_secondary_header_format_id[] = { -/* convert time from utc to julian values */ -void utc_to_julian ( int utc, int* year, int* julianday, int* hour, int* minute, int* second ) -{ - static int Days[2][13] = - { - { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } - }; - - int j, days_yr[2], left, secs; - - /* oops... */ - if ( ! year || ! julianday || ! hour || ! minute || ! second ) return; - - *year = 1970; - *julianday = 0; - *hour = 0; - *minute = 0; - *second = 0; - - days_yr[0] = days_yr[1] = 0; - - for ( j=1; j < 13; ++j ) - { - days_yr[0] += Days[0][j]; - days_yr[1] += Days[1][j]; - } - - left = utc; - secs = days_yr[Leap(*year)] * 24 * 60 * 60; - - while (left > secs) - { - ++(*year); - left -= secs; - secs = days_yr[Leap(*year)] * 24 * 60 * 60; - } - - *julianday = (left / (24 * 60 * 60)) + 1; - left = left % (24 * 60 * 60); - - *hour = left / (60 * 60); - left = left % (60 * 60); - - *minute = left / 60; - - *second = left % 60; - -} - - - /* convert ccsds embedded time to a human readable string - NOT THREAD SAFE */ static const char* embedded_time_to_string ( int coarse_time, int fine_time ) { - static const char* fmt = "%04d/%03d:%02d:%02d:%02d.%03d"; - static char juliantime[40]; static int utcdiff = 0; - - int utc, yr, year, julianday, hour, minute, second, fraction; + nstime_t t; + int yr; + int fraction; int multiplier = 1000; /* compute the static constant difference in seconds @@ -313,15 +260,11 @@ static const char* embedded_time_to_string ( int coarse_time, int fine_time ) utcdiff += 5 * 24 * 60 * 60; /* five days of January 1980 */ } - utc = coarse_time + utcdiff; - utc_to_julian ( utc, &year, &julianday, &hour, &minute, &second ); - + t.secs = coarse_time + utcdiff; fraction = ( multiplier * ( (int)fine_time & 0xff ) ) / 256; + t.nsecs = fraction*1000000; /* msecs to nsecs */ - g_snprintf ( juliantime, sizeof(juliantime), fmt, year, julianday, hour, minute, second, fraction ); - - return juliantime; - + return abs_time_to_str(&t, ABSOLUTE_TIME_DOY_UTC); } diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c index dcdcc3bc90..c90fb879b7 100644 --- a/epan/dissectors/packet-collectd.c +++ b/epan/dissectors/packet-collectd.c @@ -1108,7 +1108,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, FALSE); + vdispatch.time_str = abs_time_secs_to_str ((time_t) vdispatch.time, ABSOLUTE_TIME_LOCAL); 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 1508ea6e37..19f6de062e 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, FALSE)); + abs_time_secs_to_str(timex.secs, ABSOLUTE_TIME_LOCAL)); } 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, FALSE); + abs_time_secs_to_str(lease_expiration_time, ABSOLUTE_TIME_LOCAL); 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, FALSE); + abs_time_secs_to_str(potential_expiration_time, ABSOLUTE_TIME_LOCAL); 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, FALSE); + abs_time_secs_to_str(grace_expiration_time, ABSOLUTE_TIME_LOCAL); 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, FALSE); + abs_time_secs_to_str(client_last_transaction_time, ABSOLUTE_TIME_LOCAL); 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, FALSE)); + abs_time_secs_to_str(client_last_transaction_time, ABSOLUTE_TIME_LOCAL)); 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, FALSE); + abs_time_secs_to_str(start_time_of_state, ABSOLUTE_TIME_LOCAL); 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, FALSE)); + abs_time_secs_to_str(start_time_of_state, ABSOLUTE_TIME_LOCAL)); break; case DHCP_FO_PD_SERVERSTATE: diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index 0a24ccd3c5..c6048ca2d4 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, FALSE)); + abs_time_secs_to_str (dmp.subm_time, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + abs_time_secs_to_str (dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL)); } 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, FALSE)); + abs_time_secs_to_str (dmp.subm_time, ABSOLUTE_TIME_LOCAL)); } 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, FALSE) : - abs_time_secs_to_str (dmp.subm_time - secs, FALSE)); + abs_time_secs_to_str (dmp.subm_time + secs, ABSOLUTE_TIME_LOCAL) : + abs_time_secs_to_str (dmp.subm_time - secs, ABSOLUTE_TIME_LOCAL)); } offset += 1; } diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index ba3861f70f..634670e2d5 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -1569,7 +1569,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, FALSE)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1589,7 +1589,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, FALSE)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_2bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1612,7 +1612,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, FALSE)); + proto_item_append_text(point_item, ", Value: %u, Timestamp: %s", al_bit, abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); proto_item_set_len(point_item, data_pos - offset); offset = data_pos; @@ -1836,7 +1836,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, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); proto_tree_add_time(point_tree, hf_dnp3_al_timestamp, tvb, data_pos, 6, &al_abstime); data_pos += 6; break; @@ -1943,7 +1943,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, FALSE)); + proto_item_append_text(point_item, ", Timestamp: %s", abs_time_to_str(&al_abstime, ABSOLUTE_TIME_LOCAL)); 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 93cb0c55ce..e84758f7fa 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, FALSE)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL)); 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, FALSE), tsig_timehi == 0 ? "" : "(high bits set)"); + abs_time_to_str(&nstime, ABSOLUTE_TIME_LOCAL), 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 431a26c4ae..0a5f7704ad 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, FALSE); + time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL); 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, FALSE); + time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL); 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, FALSE); + time_string = abs_time_secs_to_str(time_since_2000, ABSOLUTE_TIME_LOCAL); 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 4e0ceed2ab..9cac6d702f 100644 --- a/epan/dissectors/packet-goose.c +++ b/epan/dissectors/packet-goose.c @@ -507,7 +507,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, TRUE); + ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC); if(hf_index >= 0) { diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c index 73c28cc088..1d4aadd2f6 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -956,7 +956,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, FALSE); + aTime = abs_time_secs_to_str(theTime, ABSOLUTE_TIME_LOCAL); 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 2e7a8e09fd..5e02b9056d 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, TRUE)); + ts, "%s", abs_time_secs_to_str(ts, ABSOLUTE_TIME_UTC)); } } diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c index 4e90490198..b25f50857c 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), FALSE)); + abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2), ABSOLUTE_TIME_LOCAL)); } 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 531a2dc7a6..bd193e370b 100644 --- a/epan/dissectors/packet-kink.c +++ b/epan/dissectors/packet-kink.c @@ -357,7 +357,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, TRUE)); + abs_time_secs_to_str(timer, ABSOLUTE_TIME_UTC)); offset += 4; if(payload_length > PAYLOAD_HEADER){ @@ -419,7 +419,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, TRUE)); + abs_time_secs_to_str(timer, ABSOLUTE_TIME_UTC)); offset += 4; if(payload_length > PAYLOAD_HEADER){ diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index e3b4bcf874..792c176c59 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, FALSE); + ptr = abs_time_secs_to_str(t, ABSOLUTE_TIME_LOCAL); 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 57c9975e1d..223dc8eb98 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -1868,7 +1868,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, TRUE); + ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); @@ -1951,7 +1951,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, TRUE); + ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC); if(hf_index >= 0) { diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index f057005860..f021302eac 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, FALSE); + strval = abs_time_to_str(&tmptime, ABSOLUTE_TIME_LOCAL); /* 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 959dbe56fb..44349c9217 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, FALSE)); + 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)); 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, FALSE)); + 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)); 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, FALSE)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Creation Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Modification Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Purge Time: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Modification Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Creation Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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, FALSE)); + 4, &ns, "Timestamp: %s", abs_time_secs_to_str(ns.secs, ABSOLUTE_TIME_LOCAL)); 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 60a544613e..ee2460984a 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, FALSE)); + (bignum==0) ? "not revoked" : abs_time_secs_to_str(bignum, ABSOLUTE_TIME_LOCAL)); break; case PKTC_MTAFQDN_REP: diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index e10f0c0270..5245e5e79c 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, FALSE)); + proto_item_append_text(avp_item, "%s", abs_time_to_str(&time_ptr, ABSOLUTE_TIME_LOCAL)); } 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 751d14aa63..4326cbdc8f 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -1100,7 +1100,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, FALSE)); + abs_time_secs_to_str(seconds, ABSOLUTE_TIME_LOCAL)); offset+=8; len_remain=0; } diff --git a/epan/dissectors/packet-time.c b/epan/dissectors/packet-time.c index ee25df4f43..771b3965e9 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, FALSE)); + abs_time_secs_to_str(delta_seconds-2208988800U, ABSOLUTE_TIME_LOCAL)); } } } diff --git a/epan/dissectors/packet-vcdu.c b/epan/dissectors/packet-vcdu.c index 346726dfb1..1f838a0530 100644 --- a/epan/dissectors/packet-vcdu.c +++ b/epan/dissectors/packet-vcdu.c @@ -150,19 +150,14 @@ static const value_string smex_data_class[] = { -/* prototype of utc to julian time conversion function - see packet-ccsds.c for the full source code */ -extern void utc_to_julian ( int utc, int* year, int* julianday, int* hour, int* minute, int* second ); - - /* convert smex PB5 header time to a human readable string - NOT THREAD SAFE * * note: this is not true PB5 time either, but a tsi specific version, although it is similar */ static const char* smex_time_to_string ( int pb5_days_since_midnight_9_10_oct_1995, int pb5_seconds, int pb5_milliseconds ) { - static const char* fmt = "%04d/%03d:%02d:%02d:%02d.%03d"; - static char juliantime[40]; static int utcdiff = 0; + nstime_t t; static int Days[2][13] = { @@ -170,7 +165,7 @@ static const char* smex_time_to_string ( int pb5_days_since_midnight_9_10_oct_19 { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } }; - int utc, yr, year, julianday, hour, minute, second; + int yr; int ix, days, month; /* compute the static constant difference in seconds @@ -197,13 +192,10 @@ static const char* smex_time_to_string ( int pb5_days_since_midnight_9_10_oct_19 utcdiff += days * 24 * 60 * 60; /* add days in 1995 prior to October 10 */ } - utc = ( pb5_days_since_midnight_9_10_oct_1995 * 86400 ) + pb5_seconds + utcdiff; - utc_to_julian ( utc, &year, &julianday, &hour, &minute, &second ); - - g_snprintf ( juliantime, sizeof(juliantime), fmt, year, julianday, hour, minute, second, pb5_milliseconds ); - - return juliantime; + 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); } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index 68bc82db11..7a270687ff 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -1798,7 +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 { - val_str = abs_time_secs_to_str(val, FALSE); + val_str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); ti = proto_tree_add_string (wsp_headers, hf_hdr_x_wap_tod, tvb, hdr_start, hdr_len + val_len, val_str); @@ -2833,7 +2833,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, FALSE); \ + str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); \ 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); \ @@ -2868,7 +2868,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, FALSE); \ + str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); \ 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); \ @@ -2921,7 +2921,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, FALSE); \ + str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); \ 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); \ @@ -3591,7 +3591,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, FALSE); + val_str = abs_time_secs_to_str(val, ABSOLUTE_TIME_LOCAL); str = g_strdup_printf("; date=%s", val_str); proto_item_append_string(ti, str); g_free(str); /* proto_XXX creates a copy */ |