[ 
https://issues.apache.org/jira/browse/AVRO-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17890105#comment-17890105
 ] 

Kalle Niemitalo commented on AVRO-4080:
---------------------------------------

I had previously reported this bug in 
[https://github.com/apache/avro/pull/1628#discussion_r868952116] and 
[https://issues.apache.org/jira/browse/AVRO-3078?focusedCommentId=17556692&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17556692].

Attached [^LocalTimestampTest.cs] to demonstrate the bug.  Running this in 
Finland, with UTC+2 East Europe Standard Time, I get:

{quote}
AvroTimeDemo.LocalTimestampTest.MillisecondToBase
Assert.Equal() Failure: Values differ
Expected: 86400000
Actual:   79200000

AvroTimeDemo.LocalTimestampTest.MillisecondToLogical
Assert.Equal() Failure: Values differ
Expected: 1970-01-02T00:00:00.0000000
Actual:   1970-01-02T02:00:00.0000000
{quote}




> 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.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.  
> TimeZoneInfo.Local should not affect these methods at all.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to