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

Closes #18727
This commit is contained in:
Vamsi Krishna Kanjeevaram 2025-04-10 06:03:40 +05:30 committed by GitHub
parent 5f311506dc
commit ad19d2c967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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;
}