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

ASF subversion and git services commented on AVRO-2792:
-------------------------------------------------------

Commit 3226f4ef7eab4e27b10b5a5266de15f78849c3db in avro's branch 
refs/heads/AVRO-2806 from Kengo Seki
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=3226f4e ]

AVRO-2792: Fix C# logical type tests to work in other timezones than UTC


> Fix C# logical type tests to work in other timezones than UTC
> -------------------------------------------------------------
>
>                 Key: AVRO-2792
>                 URL: https://issues.apache.org/jira/browse/AVRO-2792
>             Project: Apache Avro
>          Issue Type: Bug
>            Reporter: Kengo Seki
>            Assignee: Kengo Seki
>            Priority: Major
>             Fix For: 1.10.0
>
>
> I ran the C# unit tests outside of a container and got the following error. 
> This is because my machine's timezone is JST (UTC+9).
> {code}
> $ cd lang/csharp
> $ ./build.sh test
> (snip)
>   X TestLogical_TimestampMicrosecond() [22ms]
>   Error Message:
>      Expected: 1990-01-01 14:15:30
>   But was:  1990-01-01 05:15:30
>   Stack Trace:
>      at Avro.Test.Generic.GenericTests.test[T](String s, T value) in 
> /home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
>  38
>    at Avro.Test.Generic.GenericTests.TestLogical_TimestampMicrosecond() in 
> /home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
>  139
>   X TestLogical_TimestampMillisecond() [< 1ms]
>   Error Message:
>      Expected: 1990-01-01 14:15:30
>   But was:  1990-01-01 05:15:30
>   Stack Trace:
>      at Avro.Test.Generic.GenericTests.test[T](String s, T value) in 
> /home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
>  38
>    at Avro.Test.Generic.GenericTests.TestLogical_TimestampMillisecond() in 
> /home/sekikn/repos/avro/lang/csharp/src/apache/test/Generic/GenericTests.cs:line
>  133
>   X TestTimestampMicrosecond("01/01/2019 14:20:00","01/01/2019 14:20:00Z") [< 
> 1ms]
>   Error Message:
>      Expected: 2019-01-01 14:20:00
>   But was:  2019-01-01 05:20:00
>   Stack Trace:
>      at Avro.Test.LogicalTypeTests.TestTimestampMicrosecond(String s, String 
> e) in 
> /home/sekikn/repos/avro/lang/csharp/src/apache/test/Util/LogicalTypeTests.cs:line
>  143
>   X TestTimestampMillisecond("01/01/2019 14:20:00","01/01/2019 14:20:00Z") [< 
> 1ms]
>   Error Message:
>      Expected: 2019-01-01 14:20:00
>   But was:  2019-01-01 05:20:00
>   Stack Trace:
>      at Avro.Test.LogicalTypeTests.TestTimestampMillisecond(String s, String 
> e) in 
> /home/sekikn/repos/avro/lang/csharp/src/apache/test/Util/LogicalTypeTests.cs:line
>  119
> Test Run Failed.
> Total tests: 584
>      Passed: 580
>      Failed: 4
>  Total time: 2.3598 Seconds
> {code}
> [As the specification 
> says|https://avro.apache.org/docs/current/spec.html#Timestamp+%28millisecond+precision%29],
>  Avro's timestamp logical type has a long value that represents the 
> difference from the unix epoch (1 Jan 1970 00:00:00 UTC) and it doesn't have 
> timezone information. So when deserializing it, it's returned as a C# 
> DateTime object with UTC.
> Therefore, if the input string lacks timezone information, we should assume 
> it represents UTC datetime in these test cases.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to