[
https://issues.apache.org/jira/browse/AVRO-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kalle Niemitalo updated AVRO-4080:
----------------------------------
Description:
In the C# implementation of logical types "local-timestamp-millis" and
"local-timestamp-micros", the conversion between DateTime and Int64 depends on
the local time zone of the process: ConvertToBaseValue calls
DateTime.ToUniversalTime(), and ConvertToLogicalValue calls
DateTime.ToLocalTime(). These time zone conversions should not be done.
Instead, ConvertToBaseValue should discard DateTime.Kind, and
ConvertToLogicalValue should set DateTimeKind.Unspecified.
According to the Avro 1.12.0 specification:
{quote}
The {{time-millis}} logical type represents a time of day, with no reference to
a particular calendar, time zone or date, with a precision of one millisecond.
{quote}
As there is no reference to a time zone, the value must not be assumed to be in
the local time zone of the process. The current C# implementation is not
consistent with the Java implementation, either.
was:In the C# implementation of logical types "local-timestamp-millis" and
"local-timestamp-micros", the conversion between DateTime and Int64 depends on
the local time zone of the process: ConvertToBaseValue calls
DateTime.ToUniversalTime(), and ConvertToLogicalValue calls
DateTime.ToLocalTime(). These time zone conversions should not be done.
Instead, ConvertToBaseValue should discard DateTime.Kind, and
ConvertToLogicalValue should set DateTimeKind.Unspecified. TimeZoneInfo.Local
should not affect these methods at all.
> C# local-timestamp-* conversions are affected by local time zone
> ----------------------------------------------------------------
>
> Key: AVRO-4080
> URL: https://issues.apache.org/jira/browse/AVRO-4080
> Project: Apache Avro
> Issue Type: Bug
> Components: csharp, logical types
> Affects Versions: 1.11.1, 1.12.0
> Reporter: Kalle Niemitalo
> Priority: Major
> Attachments: LocalTimestampTest.cs
>
>
> In the C# implementation of logical types "local-timestamp-millis" and
> "local-timestamp-micros", the conversion between DateTime and Int64 depends
> on the local time zone of the process: ConvertToBaseValue calls
> DateTime.ToUniversalTime(), and ConvertToLogicalValue calls
> DateTime.ToLocalTime(). These time zone conversions should not be done.
> Instead, ConvertToBaseValue should discard DateTime.Kind, and
> ConvertToLogicalValue should set DateTimeKind.Unspecified.
> According to the Avro 1.12.0 specification:
> {quote}
> The {{time-millis}} logical type represents a time of day, with no reference
> to a particular calendar, time zone or date, with a precision of one
> millisecond.
> {quote}
> As there is no reference to a time zone, the value must not be assumed to be
> in the local time zone of the process. The current C# implementation is not
> consistent with the Java implementation, either.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)