fix(worker): send the Write2/WriteSecured2 time argument as box-local time (#228)
MXAccess reads the VT_DATE time argument of Write2, WriteSecured2 and their bulk forms as box-local time and converts it to UTC itself. The worker passed the proto Timestamp's UTC clock fields (the COM marshaler ignores DateTime.Kind), so on vd03 (UTC-5) a Write2 sent at 01:33:00Z was stored at 06:33:00Z. VariantConverter.ConvertToComTimestamp converts a timestamp_value instant with TimeZoneInfo.ConvertTimeFromUtc into the worker's zone (TimeZoneInfo.Local by default, DST included; an injectable zone for tests). The executor uses it for the time argument only: value conversion is unchanged, and the read direction (MXAccess reports UTC; ToTimestamp treats it as UTC) is unchanged. The one residual loss is MXAccess-side: the repeated fall-back hour cannot be told apart in an offset-less VT_DATE. Tests: VariantConverterTimestampTests (UTC-5, US-Eastern DST both edges, UTC+05:30, UTC, fall-back ambiguity, value path unchanged); the four executor forwarding tests inject a fixed UTC-5 zone; the windev live Write2 smoke now sends a past whole-second timestamp and asserts the stored one when applied. Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
@@ -27,8 +27,9 @@ public sealed class LiveGatewayWrite2Tests(ITestOutputHelper output)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The source timestamp after Write2 equals the timestamp sent. On a host whose clock is not
|
||||
/// UTC this fails until mxaccessgw#228 is fixed (MXAccess reads the VT_DATE as local time).
|
||||
/// The source timestamp after Write2 equals the timestamp sent. MXAccess reads the VT_DATE
|
||||
/// time argument as box-local time; a worker without the mxaccessgw#228 fix sends UTC clock
|
||||
/// fields, so on a host whose clock is not UTC this fails by the host's UTC offset.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[LiveGatewayWriteFact(requireTimestampOptIn: true)]
|
||||
|
||||
Reference in New Issue
Block a user