MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / timeToString

Function timeToString

src/Engine/CrossPlatform.cpp:820–843  ·  view source on GitHub ↗

* Converts a date/time into a human-readable string * using the ISO 8601 standard. * @param time Value in timestamp format. * @return String pair with date and time. */

Source from the content-addressed store, hash-verified

818 * @return String pair with date and time.
819 */
820std::pair<std::wstring, std::wstring> timeToString(time_t time)
821{
822 wchar_t localDate[25], localTime[25];
823
824/*#ifdef _WIN32
825 LARGE_INTEGER li;
826 li.QuadPart = time;
827 FILETIME ft;
828 ft.dwHighDateTime = li.HighPart;
829 ft.dwLowDateTime = li.LowPart;
830 SYSTEMTIME st;
831 FileTimeToLocalFileTime(&ft, &ft);
832 FileTimeToSystemTime(&ft, &st);
833
834 GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, localDate, 25);
835 GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, localTime, 25);
836#endif*/
837
838 struct tm *timeinfo = localtime(&(time));
839 wcsftime(localDate, 25, L"%Y-%m-%d", timeinfo);
840 wcsftime(localTime, 25, L"%H:%M", timeinfo);
841
842 return std::make_pair(localDate, localTime);
843}
844
845/**
846 * Compares two Unicode strings using natural human ordering.

Callers 1

getSaveInfoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected