Display local time instead of UTC while restoring previous session (#18775)

Closes #18727

(cherry picked from commit ad19d2c967e896c5426b9d98dfdbc2c4279eb319)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgYvbLU
Service-Version: 1.23
This commit is contained in:
Vamsi Krishna Kanjeevaram 2025-04-10 06:03:40 +05:30 committed by Dustin L. Howett
parent 3e70851d82
commit aceb042499

View File

@ -1831,9 +1831,23 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
FILETIME lastWriteTime;
FILETIME localFileTime;
SYSTEMTIME lastWriteSystemTime;
if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime) ||
!FileTimeToSystemTime(&lastWriteTime, &lastWriteSystemTime))
// Get the last write time in UTC
if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime))
{
return;
}
// Convert UTC FILETIME to local FILETIME
if (!FileTimeToLocalFileTime(&lastWriteTime, &localFileTime))
{
return;
}
// Convert local FILETIME to SYSTEMTIME
if (!FileTimeToSystemTime(&localFileTime, &lastWriteSystemTime))
{
return;
}