diff --git a/src/wstationd.c b/src/wstationd.c index 925ef0f..7b9d4cc 100644 --- a/src/wstationd.c +++ b/src/wstationd.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -180,16 +181,18 @@ int main(int argc, char *argv[]) // Collect the time of the connection, process it into // a short string - time_t timeraw = time(NULL); - struct tm* timeptr = localtime(&timeraw); - char timebuff[15]; - strftime(&timebuff[0], 15, "%Y%m%d%H%M%S", timeptr); + struct timeval tvtime; + gettimeofday(&tvtime, NULL); + struct tm* timeptr = localtime(&tvtime.tv_sec); + char timebuff[20]; + strftime(&timebuff[0], 20, "%Y%m%d%H%M%S", timeptr); // Take the short date/time connection string and add the client address // to create a filename - char fnbuff[35]; - snprintf(&fnbuff[0], 34, "%s-%s.dat", - timebuff, inet_ntoa(client.sin_addr) + char fnbuff[50]; + snprintf(&fnbuff[0], 50, "%s.%ld-%s.dat", + timebuff, tvtime.tv_usec, + inet_ntoa(client.sin_addr) ); // Open a file to dump our data to