mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 05:53:02 +01:00
Part of #11437: Move GetDateLocal and GetTimeLocal in Platform2.h
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "platform.h"
|
||||
#include "Platform2.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
@@ -64,6 +64,34 @@ static uint32_t _frequency = 0;
|
||||
static LARGE_INTEGER _entryTimestamp;
|
||||
#endif // _WIN32
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
rct2_date GetDateLocal()
|
||||
{
|
||||
auto time = std::time(nullptr);
|
||||
auto localTime = std::localtime(&time);
|
||||
|
||||
rct2_date outDate;
|
||||
outDate.day = localTime->tm_mday;
|
||||
outDate.day_of_week = localTime->tm_wday;
|
||||
outDate.month = localTime->tm_mon;
|
||||
outDate.year = localTime->tm_year;
|
||||
return outDate;
|
||||
}
|
||||
|
||||
rct2_time GetTimeLocal()
|
||||
{
|
||||
auto time = std::time(nullptr);
|
||||
auto localTime = std::localtime(&time);
|
||||
|
||||
rct2_time outTime;
|
||||
outTime.hour = localTime->tm_hour;
|
||||
outTime.minute = localTime->tm_min;
|
||||
outTime.second = localTime->tm_sec;
|
||||
return outTime;
|
||||
}
|
||||
} // namespace Platform
|
||||
|
||||
using update_palette_func = void (*)(const uint8_t*, int32_t, int32_t);
|
||||
|
||||
GamePalette gPalette;
|
||||
|
||||
Reference in New Issue
Block a user