From Jakub Zawadzki:

ctime() is not thread safe and it's obsolete.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4302

svn path=/trunk/; revision=31200
This commit is contained in:
Anders Broman 2009-12-08 07:41:43 +00:00
parent c70da4bd10
commit 62c3372576
3 changed files with 5 additions and 14 deletions

View File

@ -1286,8 +1286,7 @@ dissect_version_5_primary_header(packet_info *pinfo,
return 0;
}
time_since_2000 = (time_t) (timestamp + 946684800);
time_string = ctime(&time_since_2000);
time_string[strlen(time_string) - 1] = 0; /*Remove Newline at enc*/
time_string = abs_time_secs_to_str(time_since_2000);
proto_item_set_text(timestamp_item,
"Timestamp: 0x%x [%s]", timestamp, time_string);
offset += sdnv_length;
@ -2094,8 +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 = ctime(&time_since_2000);
time_string[strlen(time_string) - 1] = 0; /*Remove Newline at enc*/
time_string = abs_time_secs_to_str(time_since_2000);
proto_tree_add_text(tree, tvb, offset, sdnv_length,
"%s (sec): %d [%s]", field_id, sdnv_value, time_string);
offset += sdnv_length;
@ -2126,8 +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 = ctime(&time_since_2000);
time_string[strlen(time_string) - 1] = 0; /*Remove Newline at enc*/
time_string = abs_time_secs_to_str(time_since_2000);
proto_tree_add_text(tree, tvb, offset, sdnv_length,
"%s: %d [%s]", field_id, sdnv_value, time_string);
return sdnv_length;

View File

@ -957,8 +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 = ctime(&theTime);
aTime[strlen(aTime)-1] = '\0';
aTime = abs_time_secs_to_str(theTime);
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);

View File

@ -249,12 +249,7 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
/*
* Format ascii representaion of time
*/
ptr = ctime(&t);
/*
* Delete final '\n'
*/
ptr[strlen(ptr) - 1] = 0;
ptr = abs_time_secs_to_str(t);
proto_tree_add_text(reqresp_tree, tvb, offset,
tokenlen, "Time: %s", ptr);
}