diff -ur wireless_tools.27/iwevent.c wireless_tools.27_jmglov/iwevent.c --- wireless_tools.27/iwevent.c 2004-06-30 10:15:55.000000000 +0900 +++ wireless_tools.27_jmglov/iwevent.c 2005-10-05 16:58:09.972908936 +0900 @@ -451,6 +451,8 @@ int i = 0; int ret; char buffer[64]; + time_t curtime; + struct tm recv_tm; struct timeval recv_time; struct wireless_iface * wireless_data; @@ -460,8 +462,10 @@ return(-1); /* Print received time in readable form */ + curtime = time(NULL); + localtime_r(&curtime, &recv_tm); gettimeofday(&recv_time, NULL); - iw_print_timeval(buffer, sizeof(buffer), &recv_time); + iw_print_timeval_local(buffer, sizeof(buffer), &recv_time, &recv_tm); iw_init_event_stream(&stream, data, len); do diff -ur wireless_tools.27/iwlib.c wireless_tools.27_jmglov/iwlib.c --- wireless_tools.27/iwlib.c 2004-10-28 05:55:17.000000000 +0900 +++ wireless_tools.27_jmglov/iwlib.c 2005-10-05 17:10:35.887512680 +0900 @@ -1770,14 +1770,31 @@ void iw_print_timeval(char * buffer, int buflen, - const struct timeval * time) + const struct timeval * tv) { int s; - s = (time->tv_sec) % 86400; + s = (tv->tv_sec) % 86400; snprintf(buffer, buflen, "%02d:%02d:%02d.%06u ", s / 3600, (s % 3600) / 60, - s % 60, (u_int32_t) time->tv_usec); + s % 60, (u_int32_t) tv->tv_usec); +} + +/*------------------------------------------------------------------*/ +/* + * Print timestamps in local time + * Inspired by iw_print_timeval()... + * Coded by Josh Glover + */ +void + iw_print_timeval_local(char * buffer, + int buflen, + const struct timeval * tv, + const struct tm * tm) +{ + snprintf(buffer, buflen, "%02d:%02d:%02d.%06u ", + tm->tm_hour, tm->tm_min, + tm->tm_sec, (u_int32_t) tv->tv_usec); } /*********************** ADDRESS SUBROUTINES ************************/ diff -ur wireless_tools.27/iwlib.h wireless_tools.27_jmglov/iwlib.h --- wireless_tools.27/iwlib.h 2004-10-29 09:09:47.000000000 +0900 +++ wireless_tools.27_jmglov/iwlib.h 2005-10-05 17:09:50.238452392 +0900 @@ -30,6 +30,7 @@ #include /* gethostbyname, getnetbyname */ #include /* struct ether_addr */ #include /* struct timeval */ +#include /* time, struct tm */ #include /* This is our header selection. Try to hide the mess and the misery :-( @@ -430,7 +431,12 @@ void iw_print_timeval(char * buffer, int buflen, - const struct timeval * time); + const struct timeval * tv); +void + iw_print_timeval_local(char * buffer, + int buflen, + const struct timeval * tv, + const struct tm * tm); /* --------------------- ADDRESS SUBROUTINES ---------------------- */ int iw_check_mac_addr_type(int skfd,