From 4e225eea73f87fc01251691390a65436c30baf22 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 6 Nov 2009 08:27:04 +0100 Subject: Extract morgue file time formatting into make_file_time. --- crawl-ref/source/ouch.cc | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'crawl-ref/source/ouch.cc') 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 #include #include -#include #ifdef TARGET_OS_DOS #include @@ -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 } -- cgit v1.2.3-54-g00ecf