[ 
https://issues.apache.org/jira/browse/ARROW-7508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anthony Abate updated ARROW-7508:
---------------------------------
    Summary: [C#] DateTime32 Reading is Broken  (was: [C#] DateTime Reading is 
Broken)

> [C#] DateTime32 Reading is Broken
> ---------------------------------
>
>                 Key: ARROW-7508
>                 URL: https://issues.apache.org/jira/browse/ARROW-7508
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C#
>    Affects Versions: 0.15.1
>            Reporter: Anthony Abate
>            Assignee: Anthony Abate
>            Priority: Critical
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> DateTime support for writing works - but reading is broken.
> This is another arithmetic overflow bug (reported a few already) which is 
> causing date to be misinterpreted
>  I extracted the current logic out to linqpad and to show the bug and fix:
>  
> {code:java}
>       var dto = DateTimeOffset.Parse("2024-09-25");
>       (dto.ToUnixTimeMilliseconds() / 86400000).Dump();
>       // YIELDS: 19991
>       
>       unchecked  (current code)
>       {
>               DateTimeOffset.FromUnixTimeMilliseconds(19991 * 
> 86400000).Dump();
>               // 1/8/1970 WRONG
>       }       
>         checked
>       {
>               DateTimeOffset.FromUnixTimeMilliseconds((long)19991 * 
> 86400000).Dump();
>               // 9/25/2024 CORRECT
>       } {code}
>  
>  
> this fix is trivial - a cast to long is missing where ever 
> *FromUnixTimeMilliseconds* is used
>  
>  



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

Reply via email to