diff options
Diffstat (limited to 'toxcore/util.c')
-rw-r--r-- | toxcore/util.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/toxcore/util.c b/toxcore/util.c index d3df64c1..0cafe320 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -139,8 +139,10 @@ void loginit(uint16_t port) | |||
139 | if (logfile) | 139 | if (logfile) |
140 | fclose(logfile); | 140 | fclose(logfile); |
141 | 141 | ||
142 | if (!starttime) | 142 | if (!starttime) { |
143 | starttime = now(); | 143 | unix_time_update(); |
144 | starttime = unix_time(); | ||
145 | } | ||
144 | 146 | ||
145 | struct tm *tm = localtime(&starttime); | 147 | struct tm *tm = localtime(&starttime); |
146 | 148 | ||
@@ -164,7 +166,7 @@ void loginit(uint16_t port) | |||
164 | void loglog(char *text) | 166 | void loglog(char *text) |
165 | { | 167 | { |
166 | if (logfile) { | 168 | if (logfile) { |
167 | fprintf(logfile, "%4u %s", (uint32_t)(now() - starttime), text); | 169 | fprintf(logfile, "%4u %s", (uint32_t)(unix_time() - starttime), text); |
168 | fflush(logfile); | 170 | fflush(logfile); |
169 | 171 | ||
170 | return; | 172 | return; |
@@ -175,7 +177,9 @@ void loglog(char *text) | |||
175 | size_t len = strlen(text); | 177 | size_t len = strlen(text); |
176 | 178 | ||
177 | if (!starttime) { | 179 | if (!starttime) { |
178 | starttime = now(); | 180 | unix_time_update(); |
181 | starttime = unix_time(); | ||
182 | |||
179 | logbufferprelen = 1024 + len - (len % 1024); | 183 | logbufferprelen = 1024 + len - (len % 1024); |
180 | logbufferpredata = malloc(logbufferprelen); | 184 | logbufferpredata = malloc(logbufferprelen); |
181 | logbufferprehead = logbufferpredata; | 185 | logbufferprehead = logbufferpredata; |
@@ -193,7 +197,7 @@ void loglog(char *text) | |||
193 | logbufferprelen = lennew; | 197 | logbufferprelen = lennew; |
194 | } | 198 | } |
195 | 199 | ||
196 | int written = sprintf(logbufferprehead, "%4u %s", (uint32_t)(now() - starttime), text); | 200 | int written = sprintf(logbufferprehead, "%4u %s", (uint32_t)(unix_time() - starttime), text); |
197 | logbufferprehead += written; | 201 | logbufferprehead += written; |
198 | } | 202 | } |
199 | 203 | ||