[lib] Rename sub_date() -> time_elapsed()
This commit is contained in:
parent
829982766d
commit
10a47246f4
|
@ -390,7 +390,7 @@ void* monitor_couples()
|
|||
struct timeval current_time ;
|
||||
FILE *fd = NULL ;
|
||||
char *mac_string ;
|
||||
unsigned long sub ; // sub_date() result
|
||||
unsigned long sub ; // time_elapsed() result
|
||||
|
||||
unsigned long aggregate_timeout =
|
||||
(unsigned long) cfg_getint(cfg, "aggregate_timeout") ;
|
||||
|
@ -430,7 +430,7 @@ void* monitor_couples()
|
|||
|
||||
while (couple_ptr != NULL) // Parsing list
|
||||
{
|
||||
sub = sub_date(couple_ptr->start_time, current_time) ;
|
||||
sub = time_elapsed(couple_ptr->start_time, current_time) ;
|
||||
|
||||
// If the couple was not treated already
|
||||
if (couple_ptr->info != NULL)
|
||||
|
@ -604,8 +604,8 @@ void got_couple_info(couple_message message)
|
|||
{ // Research criterion: MAC and transmission time
|
||||
if (mac_equals(message.mobile_mac_addr_bytes,
|
||||
tmp_couple->mobile_mac_addr_bytes) == 1
|
||||
&& sub_date(message.request_time,
|
||||
tmp_couple->request_time) == 0)
|
||||
&& time_elapsed(message.request_time,
|
||||
tmp_couple->request_time) == 0)
|
||||
break ; // If the couple exists, we stop on it
|
||||
tmp_couple = tmp_couple->next ;
|
||||
}
|
||||
|
@ -618,8 +618,8 @@ void got_couple_info(couple_message message)
|
|||
// TODO : define an option for the maximal difference time.
|
||||
if (mac_equals(message.mobile_mac_addr_bytes,
|
||||
tmp_couple->mobile_mac_addr_bytes) == 1
|
||||
&& sub_date(message.start_time,
|
||||
tmp_couple->request_time) <= 10)
|
||||
&& time_elapsed(message.start_time,
|
||||
tmp_couple->request_time) <= 10)
|
||||
break ; // If the couple exists, we stop on it
|
||||
tmp_couple = tmp_couple->next ;
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ void delete_old_aps()
|
|||
gettimeofday(&now, NULL) ;
|
||||
|
||||
while (token_aps != NULL)
|
||||
if (sub_date(token_aps->last_seen, now) >
|
||||
if (time_elapsed(token_aps->last_seen, now) >
|
||||
(unsigned long) cfg_getint(cfg, "ap_keep_timeout") * 1000)
|
||||
delete_ap(token_aps) ;
|
||||
else
|
||||
|
|
|
@ -117,11 +117,11 @@ struct timeval ms_to_timeval(unsigned long long tms)
|
|||
/*
|
||||
* Returns the time (in milliseconds) between two dates.
|
||||
*/
|
||||
unsigned long sub_date(struct timeval sup, struct timeval inf)
|
||||
unsigned long time_elapsed(struct timeval sup, struct timeval inf)
|
||||
{
|
||||
unsigned long sub = abs(timeval_to_ms(sup) - timeval_to_ms(inf)) ;
|
||||
#ifdef DEBUG
|
||||
printf("sub_date() : sub=%lu\n", sub) ;
|
||||
printf("time_elapsed(): %lu\n", sub) ;
|
||||
#endif
|
||||
return sub ;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ char frequency_to_channel(unsigned short channel) ;
|
|||
|
||||
// Time
|
||||
unsigned long long timeval_to_ms(struct timeval date) ;
|
||||
unsigned long sub_date(struct timeval sup, struct timeval inf) ;
|
||||
unsigned long time_elapsed(struct timeval sup, struct timeval inf) ;
|
||||
|
||||
// Network
|
||||
int create_udp_sending_socket(char *server_address, int server_port,
|
||||
|
|
|
@ -47,7 +47,7 @@ int capture(char *capture_iface, unsigned long capture_time, mac_list **results,
|
|||
pcap_loop(handle, 1, got_packet, NULL) ; // Collecte 1 paquet et appelle la fonction got_packet quand pcaploop a recupéré des paquets
|
||||
|
||||
gettimeofday(&tcurrent, NULL) ; // Récupère l'heure courante
|
||||
if(sub_date(tcurrent, tbegin) > capture_time) // Si le temps de capture est écoulé
|
||||
if (time_elapsed(tcurrent, tbegin) > capture_time) // Si le temps de capture est écoulé
|
||||
break ; // on arrête la collecte.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue