summaryrefslogtreecommitdiff
path: root/src/map/map.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-01-09 00:18:53 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-01-09 00:43:27 -0800
commitf0a87e4f7f5377498960429e96be5dff183c8326 (patch)
tree2661728f73f3c163e971d94cd123ef6e378264aa /src/map/map.cpp
parentf2fd4885c2a906414e0f36acf95d252e5a9d5805 (diff)
downloadtmwa-f0a87e4f7f5377498960429e96be5dff183c8326.tar.gz
tmwa-f0a87e4f7f5377498960429e96be5dff183c8326.tar.bz2
tmwa-f0a87e4f7f5377498960429e96be5dff183c8326.tar.xz
tmwa-f0a87e4f7f5377498960429e96be5dff183c8326.zip
Make incoming packets read-only
Diffstat (limited to 'src/map/map.cpp')
-rw-r--r--src/map/map.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8732186..4e6cb66 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -1795,25 +1795,15 @@ void map_log(const_string line)
if (!map_logfile)
return;
- struct timeval tv;
- gettimeofday(&tv, NULL);
+ time_t t = time(NULL);
- if ((tv.tv_sec >> LOGFILE_SECONDS_PER_CHUNK_SHIFT) != map_logfile_index)
+ if ((t >> LOGFILE_SECONDS_PER_CHUNK_SHIFT) != map_logfile_index)
{
map_close_logfile();
- map_start_logfile(tv.tv_sec);
- }
-
- if (!line)
- {
- fputc('\n', map_logfile);
- return;
+ map_start_logfile(t);
}
- FPRINTF(map_logfile, "%ld.%06ld ", (long) tv.tv_sec, (long) tv.tv_usec);
- fwrite(line.data(), 1, line.size(), map_logfile);
- if (line.back() != '\n')
- fputc('\n', map_logfile);
+ log_with_timestamp(map_logfile, line);
}
/*==========================================