diff options
Diffstat (limited to 'toxcore/util.c')
-rw-r--r-- | toxcore/util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/toxcore/util.c b/toxcore/util.c index e751e9e4..8960fe36 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -44,6 +44,7 @@ void id_cpy(uint8_t *dest, uint8_t *src) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | #ifdef LOGGING | 46 | #ifdef LOGGING |
47 | time_t starttime = 0; | ||
47 | char logbuffer[512]; | 48 | char logbuffer[512]; |
48 | static FILE *logfile = NULL; | 49 | static FILE *logfile = NULL; |
49 | void loginit(uint16_t port) | 50 | void loginit(uint16_t port) |
@@ -53,10 +54,12 @@ void loginit(uint16_t port) | |||
53 | 54 | ||
54 | sprintf(logbuffer, "%u-%u.log", ntohs(port), now()); | 55 | sprintf(logbuffer, "%u-%u.log", ntohs(port), now()); |
55 | logfile = fopen(logbuffer, "w"); | 56 | logfile = fopen(logbuffer, "w"); |
57 | starttime = now(); | ||
56 | }; | 58 | }; |
57 | void loglog(char *text) | 59 | void loglog(char *text) |
58 | { | 60 | { |
59 | if (logfile) { | 61 | if (logfile) { |
62 | fprintf(logfile, "%4u ", now() - starttime); | ||
60 | fprintf(logfile, text); | 63 | fprintf(logfile, text); |
61 | fflush(logfile); | 64 | fflush(logfile); |
62 | } | 65 | } |