diff options
-rw-r--r-- | crawl-ref/source/AppHdr.h | 7 | ||||
-rw-r--r-- | crawl-ref/source/debug.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/hiscores.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/tags.cc | 2 |
5 files changed, 13 insertions, 6 deletions
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h index 1316e75ffb..3a1fb6c7b2 100644 --- a/crawl-ref/source/AppHdr.h +++ b/crawl-ref/source/AppHdr.h @@ -271,6 +271,13 @@ // Makes the game ask the user to hit Enter after bailing out with // an error message. #define DGL_PAUSE_AFTER_ERROR + + // Use UTC for dgamelaunch servers. + #define TIME_FN gmtime +#endif + +#ifndef TIME_FN +#define TIME_FN localtime #endif #if defined(REGEX_POSIX) && defined(REGEX_PCRE) diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index c30b52f419..c3ff393224 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -3134,7 +3134,7 @@ static std::string _fsim_weapon(int missile_slot) static std::string _fsim_time_string() { time_t curr_time = time(NULL); - struct tm *ltime = localtime(&curr_time); + struct tm *ltime = TIME_FN(&curr_time); if (ltime) { char buf[100]; diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 6267202d22..3db813841d 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -327,19 +327,19 @@ std::string hiscores_format_single(const scorefile_entry &se) static bool _hiscore_same_day( time_t t1, time_t t2 ) { - struct tm *d1 = localtime( &t1 ); + struct tm *d1 = TIME_FN( &t1 ); const int year = d1->tm_year; const int mon = d1->tm_mon; const int day = d1->tm_mday; - struct tm *d2 = localtime( &t2 ); + struct tm *d2 = TIME_FN( &t2 ); return (d2->tm_mday == day && d2->tm_mon == mon && d2->tm_year == year); } static void _hiscore_date_string( time_t time, char buff[INFO_SIZE] ) { - struct tm *date = localtime( &time ); + struct tm *date = TIME_FN( &time ); const char *mons[12] = { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index b9e509eead..2b9c8a38dd 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -955,7 +955,7 @@ static std::string morgue_name(time_t when_crawl_got_even) #else // !SHORT_FILE_NAMES std::string name = "morgue-" + std::string(you.your_name); - if (tm *loc = localtime(&when_crawl_got_even)) + if (tm *loc = TIME_FN(&when_crawl_got_even)) { char buf[25]; snprintf(buf, sizeof buf, "-%04d%02d%02d-%02d%02d%02d", diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 8d23cdf877..67d76ac6c2 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -584,7 +584,7 @@ std::string make_date_string( time_t in_date ) return (buff); } - struct tm *date = localtime( &in_date ); + struct tm *date = TIME_FN( &in_date ); snprintf( buff, sizeof buff, "%4d%02d%02d%02d%02d%02d%s", |