summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Linehan <patientulysses@gmail.com>2012-06-15 10:06:48 -0400
committerJason Linehan <patientulysses@gmail.com>2012-06-15 10:06:48 -0400
commit37f09e2202766c3292a784eec5d6280f34660385 (patch)
tree0b0eb155fe6f52d19ba05c1490566253a0cb7259
parentaee901418ebfc6dc53c26c367b29854d7cb6e4c2 (diff)
downloadcloth-37f09e2202766c3292a784eec5d6280f34660385.tar.gz
cloth-37f09e2202766c3292a784eec5d6280f34660385.tar.bz2
cloth-37f09e2202766c3292a784eec5d6280f34660385.zip
Adds epoch time to procinfo
-rw-r--r--cloth.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cloth.c b/cloth.c
index e96fdb9..ce87185 100644
--- a/cloth.c
+++ b/cloth.c
@@ -173,13 +173,18 @@ void procinfo(pid_t pid, int socket, int hit, struct sockaddr_in *client)
char *ip;
short port;
int fd;
+ time_t t;
/* Convert the client address to a char string */
ip = inet_ntoa(client->sin_addr);
- /* Convert the port number to a short */
+ /* Convert the port number to a short */
port = ntohs(client->sin_port);
+ /* Get the number of seconds since the epoch */
+ t = time(NULL);
+
+ /*getnameinfo(client, sizeof(*client), host, hostlen, serv, servlen, 0);*/
- sprintf(buf, "%d:%d:%d:%s:%hd", pid, socket, hit, ip, port);
+ sprintf(buf, "%lld:%d:%d:%d:%s:%hd", (long long)t, pid, socket, hit, ip, port);
/* Write the procinfo to the log file */
if ((fd = open(INFO_PATH, O_CREAT| O_WRONLY | O_APPEND, 0644)) >= 0) {