From 0b5ebc524f514cd627562f851da57e1447aeae6a Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Tue, 15 Mar 2011 16:16:26 +0100 Subject: [PATCH] [Listener] Use timestamp_to_string() Use owl_timestamp_to_string() instead of owl_timestamp_to_ms() to display the timestamps. --- .../owlps-listener/owlps-listenerd.c | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/infrastructure-centred/owlps-listener/owlps-listenerd.c b/infrastructure-centred/owlps-listener/owlps-listenerd.c index 3e6b91a..79d0db5 100644 --- a/infrastructure-centred/owlps-listener/owlps-listenerd.c +++ b/infrastructure-centred/owlps-listener/owlps-listenerd.c @@ -844,33 +844,38 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, /* Display the packet details */ if (GET_DISPLAY_CAPTURED()) { - char *ap_mac_string = + char *ap_mac_str = owl_mac_bytes_to_string(couple.ap_mac_addr_bytes) ; - char *mobile_mac_string = + char *mobile_mac_str = owl_mac_bytes_to_string(couple.mobile_mac_addr_bytes) ; + char + request_time_str[TIMESTAMP_STR_LEN], + start_time_str[TIMESTAMP_STR_LEN] ; + owl_timestamp_to_string(request_time_str, couple.request_time) ; + owl_timestamp_to_string(start_time_str, couple.start_time) ; printf("*** Couple to send ***\n" "\tMAC AP: %s\n" "\tMobile MAC: %s\n" - "\tSequence number (request time): %"PRIu64"\n" - "\tRequest arrival time on the AP: %"PRIu64"\n" + "\tSequence number (request time): %s\n" + "\tRequest arrival time on the AP: %s\n" "\tSignal: %d dBm\n" "\tPosition X: %f\n" "\tPosition Y: %f\n" "\tPosition Z: %f\n" "\tDirection: %hhd\n" , - ap_mac_string, - mobile_mac_string, - owl_timestamp_to_ms(couple.request_time), - owl_timestamp_to_ms(couple.start_time), + ap_mac_str, + mobile_mac_str, + request_time_str, + start_time_str, couple.antenna_signal_dbm - 0x100, couple.x_position, couple.y_position, couple.z_position, couple.direction ) ; - free(ap_mac_string) ; - free(mobile_mac_string) ; + free(ap_mac_str) ; + free(mobile_mac_str) ; } /* Send couple to the aggregator */ @@ -1061,8 +1066,11 @@ uint_fast16_t make_packet(uint8_t **packet) owl_timestamp_now(&request_time) ; if (GET_VERBOSE()) - printf("Autocalibration time: %"PRIu64"\n", - owl_timestamp_to_ms(request_time)) ; + { + char request_time_str[TIMESTAMP_STR_LEN] ; + owl_timestamp_to_string(request_time_str, request_time) ; + printf("Autocalibration time: %s\n", request_time_str) ; + } size = sizeof(char) + sizeof(TIMESTAMP) ; pkt = malloc(size) ;