summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ouch.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-06 08:27:04 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-06 08:33:00 +0100
commit4e225eea73f87fc01251691390a65436c30baf22 (patch)
tree3edc3dae8045fc71f7903ec9e5f5ca3c4d277421 /crawl-ref/source/ouch.cc
parentcb5fbd4ea61dc49c1c2587971fa486563a92a913 (diff)
downloadcrawl-ref-4e225eea73f87fc01251691390a65436c30baf22.tar.gz
crawl-ref-4e225eea73f87fc01251691390a65436c30baf22.zip
Extract morgue file time formatting into make_file_time.
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r--crawl-ref/source/ouch.cc17
1 files changed, 4 insertions, 13 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 6eecfaacac..c76fd18148 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -12,7 +12,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#include <time.h>
#ifdef TARGET_OS_DOS
#include <conio.h>
@@ -1202,18 +1201,10 @@ static std::string morgue_name(time_t when_crawl_got_even)
#else // !SHORT_FILE_NAMES
std::string name = "morgue-" + you.your_name;
- if (tm *loc = TIME_FN(&when_crawl_got_even))
- {
- char buf[25];
- snprintf(buf, sizeof buf, "-%04d%02d%02d-%02d%02d%02d",
- loc->tm_year + 1900,
- loc->tm_mon + 1,
- loc->tm_mday,
- loc->tm_hour,
- loc->tm_min,
- loc->tm_sec);
- name += buf;
- }
+ std::string time = make_file_time(when_crawl_got_even);
+ if (!time.empty())
+ name += "-" + time;
+
return (name);
#endif // SHORT_FILE_NAMES
}