[lib] Rename OWL_TIMESTAMP_STR_LEN OWL_TIMESTAMP_STRLEN

This commit is contained in:
Matteo Cypriani 2011-08-18 14:02:17 +02:00
parent ac4dd87ef9
commit de74213102
5 changed files with 12 additions and 12 deletions

View File

@ -200,12 +200,12 @@ uint64_t owl_timestamp_to_ms(const owl_timestamp d)
/*
* Converts a owl_timestamp date value into a printable string.
* 'dst' must be an allocated array of at least owl_timestamp_STR_LEN
* 'dst' must be an allocated array of at least OWL_TIMESTAMP_STRLEN
* characters.
*/
void owl_timestamp_to_string(char *const dst, const owl_timestamp src)
{
snprintf(dst, OWL_TIMESTAMP_STR_LEN, "%"PRIu32".%"PRIu32,
snprintf(dst, OWL_TIMESTAMP_STRLEN, "%"PRIu32".%"PRIu32,
src.tv_sec, src.tv_nsec) ;
}

View File

@ -53,7 +53,7 @@ typedef struct _owl_timestamp
uint32_t tv_nsec ;
} owl_timestamp ;
// Length of a owl_timestamp when converted to string:
#define OWL_TIMESTAMP_STR_LEN 22 // 22 = 10 digits, '.', 10 digits, '\0'
#define OWL_TIMESTAMP_STRLEN 22 // 22 = 10 digits, '.', 10 digits, '\0'
/* Message sent by the listener to the aggregator */

View File

@ -422,8 +422,8 @@ int read_loop(int sockfd)
char // Return values of
mobile_ip_str[INET_ADDRSTRLEN], // inet_ntop()
// and owl_timestamp_to_string():
request_time_str[OWL_TIMESTAMP_STR_LEN],
start_time_str[OWL_TIMESTAMP_STR_LEN] ;
request_time_str[OWL_TIMESTAMP_STRLEN],
start_time_str[OWL_TIMESTAMP_STRLEN] ;
while (owl_run)
{
@ -506,7 +506,7 @@ void* monitor_requests(void *NULL_value)
FILE *fd = NULL ;
char mac_str[OWL_ETHER_ADDR_STRLEN] ;
uint_fast32_t sub ; // owl_time_elapsed_ms() result
char request_time_str[OWL_TIMESTAMP_STR_LEN] ;
char request_time_str[OWL_TIMESTAMP_STRLEN] ;
uint_fast32_t aggregate_timeout =
cfg_getint(cfg, "aggregate_timeout") ;
@ -1191,8 +1191,8 @@ void print_request_list()
request_info_list *info_ptr = NULL ;
char mobile_mac_str[OWL_ETHER_ADDR_STRLEN] ;
char
request_time_str[OWL_TIMESTAMP_STR_LEN],
start_time_str[OWL_TIMESTAMP_STR_LEN] ;
request_time_str[OWL_TIMESTAMP_STRLEN],
start_time_str[OWL_TIMESTAMP_STRLEN] ;
sem_wait(&lock_requests) ;

View File

@ -373,7 +373,7 @@ void make_packet()
{
uint_fast16_t offset ; // Index used to create the packet
owl_timestamp request_time ;
char request_time_str[OWL_TIMESTAMP_STR_LEN] ;
char request_time_str[OWL_TIMESTAMP_STRLEN] ;
// Get the current time and copy it as a string before to switch it to
// network endianess:

View File

@ -977,8 +977,8 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
if (GET_DISPLAY_CAPTURED())
{
char
request_time_str[OWL_TIMESTAMP_STR_LEN],
start_time_str[OWL_TIMESTAMP_STR_LEN] ;
request_time_str[OWL_TIMESTAMP_STRLEN],
start_time_str[OWL_TIMESTAMP_STRLEN] ;
owl_timestamp_to_string(request_time_str,
owl_ntoh_timestamp(request.request_time)) ;
owl_timestamp_to_string(start_time_str,
@ -1332,7 +1332,7 @@ uint_fast16_t make_packet(uint8_t **packet)
if (VERBOSE_CHATTERBOX)
{
char request_time_str[OWL_TIMESTAMP_STR_LEN] ;
char request_time_str[OWL_TIMESTAMP_STRLEN] ;
owl_timestamp_to_string(request_time_str, request_time) ;
printf("Autocalibration time: %s\n", request_time_str) ;
}