<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - FILEOPEN DBF timestamp fields (type '@') trigger corruption error"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=143715">143715</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FILEOPEN DBF timestamp fields (type '@') trigger corruption error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dev@sheetjs.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
dBASE Level 7 DBF supports the timestamp field (type '@').  Valid DBF files
generated from dBASE are flagged as corrupt and LibreOffice fails to repair
them

Steps to Reproduce:
1. Download sample file
<a href="https://github.com/SheetJS/test_files/raw/master/dbf/d11.dbf">https://github.com/SheetJS/test_files/raw/master/dbf/d11.dbf</a>
2. open in LibreOffice


Actual Results:
Error message "The file 'd11.dbf' is corrupt and therefore cannot be opened.
LibreOffice can try to repair the file."

Attempting to repair the file yields a new error message "The file 'd11.dbf'
could not be repaired and therefore cannot be opened."

Expected Results:
The file opens properly and the field is interpreted as Date


Reproducible: Always


User Profile Reset: Yes



Additional Info:
SheetJS currently uses the following algorithm to extract values.  The
algorithm agrees with dBASE 2019 on the values in the test file:

- Parse the 8 bytes of the field as an IEEE754 double in big-endian order
- Subtract 0x388317533400 (62135683200000, a number that can be exactly
represented in a IEEE754 double)
- Interpret the code as milliseconds since January 1 1970 (which is what JS
uses as the 0 value for the native Date object)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>