Switch timestamp format to combined UTC + local so fewer stupid hacks are required.

This commit is contained in:
elasota
2020-01-23 22:36:12 -05:00
parent 6171b1185e
commit 928efdd527
8 changed files with 143 additions and 90 deletions

View File

@@ -2,6 +2,8 @@
#include <stdio.h>
#include <stdint.h>
#include "CombinedTimestamp.h"
int main(int argc, const char **argv)
{
if (argc != 2)
@@ -39,11 +41,29 @@ int main(int argc, const char **argv)
return -1;
}
uint8_t encodedTimestamp[8];
for (int i = 0; i < 8; i++)
encodedTimestamp[i] = static_cast<uint8_t>((timeDelta >> (i * 8)) & 0xff);
TIME_ZONE_INFORMATION tz;
GetTimeZoneInformation(&tz);
fwrite(encodedTimestamp, 8, 1, f);
SYSTEMTIME utcST;
FileTimeToSystemTime(&timestampFT, &utcST);
SYSTEMTIME localST;
SystemTimeToTzSpecificLocalTime(&tz, &utcST, &localST);
PortabilityLayer::CombinedTimestamp ts;
ts.SetUTCTime(timeDelta);
ts.SetLocalYear(localST.wYear);
ts.m_localMonth = localST.wMonth;
ts.m_localDay = localST.wDay;
ts.m_localHour = localST.wHour;
ts.m_localMinute = localST.wMinute;
ts.m_localSecond = localST.wSecond;
memset(ts.m_padding, 0, sizeof(ts.m_padding));
fwrite(&ts, sizeof(ts), 1, f);
fclose(f);

View File

@@ -58,15 +58,19 @@
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\PortabilityLayer.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />