Bug 127727 - Converting .xls files appears to shift metadata times the wrong way
Summary: Converting .xls files appears to shift metadata times the wrong way
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xls
Depends on:
Blocks: XLS
  Show dependency treegraph
 
Reported: 2019-09-23 23:28 UTC by Nick Matteo
Modified: 2022-04-28 03:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
.xls file created in Excel on 2019-09-25 11:30 AM MDT (25.00 KB, application/octet-stream)
2019-09-25 17:40 UTC, Nick Matteo
Details
.xlsx file after conversion by libreoffice, create date stored as 2019-09-25 11:30:34 UTC (4.62 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2019-09-25 17:42 UTC, Nick Matteo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Matteo 2019-09-23 23:28:00 UTC
Description:
Timestamps in a .xls file seem to not have a timezone. Current versions of Excel appear to save Create Date and Modify Date in UTC when saving .xls files, but other software (e.g. exiftool) interprets them as local times.

However, LibreOffice appears to interpret them as UTC, shift them to local time, then store them as UTC, which is definitely incorrect. (Equivalently, it may be interpreting them as local time, shifting them the wrong way to UTC, then storing as UTC).

Steps to Reproduce:
1. Start with a .xls file, with e.g. Create Date 2019:09:20 12:49:52.
2. Convert to .xlsx, either using `libreoffice --headless --convert-to xlsx` or by opening in the GUI and saving as .xlsx.

Actual Results:
The new file has Create Date 2019:09:20 06:49:52Z. (I am in MDT, with a UTC offset of -6 hours.) I can think of no interpretation where this could be correct.

Expected Results:
If you assume the timestamp in the .xls was already in UTC, the resulting timestamp should have been 2019:09:20 12:49:52Z.

If you assume the timestamp in the .xls was in local time (MDT for me), the resulting timestamp should have been 2019:09:20 18:49:52Z.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.2.6.2
Build ID: 1:6.2.6-0ubuntu0.19.04.1
CPU threads: 8; OS: Linux 5.0; UI render: default; VCL: kde5; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 1 Xisco Faulí 2019-09-24 11:02:40 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 Nick Matteo 2019-09-25 17:40:55 UTC
Created attachment 154500 [details]
.xls file created in Excel on 2019-09-25 11:30 AM MDT
Comment 3 Nick Matteo 2019-09-25 17:42:58 UTC
Created attachment 154501 [details]
.xlsx file after conversion by libreoffice, create date stored as 2019-09-25 11:30:34 UTC
Comment 4 Nick Matteo 2019-09-25 18:13:19 UTC
The attached .xls file was created in Microsoft Excel at 2019-09-25 11:30 AM MDT. The Create Date seems to be stored as 2019-09-25 17:30:34 (as reported by exiftool), which is the UTC time.

If LibreOffice assumes the Create Date was stored in UTC, the file after conversion should have had Create Date 2019-09-25 17:30:34Z. If LibreOffice instead assumes the Create Date was stored in local time (which is not the case, but perhaps old versions of Excel did this), the resulting file should have had Create Date 2019-09-25 23:30:34Z.

Instead, the .xlsx file resulting from `libreoffice --headless --convert-to xlsx Sep25-1139MDT.xls` (also attached) has Create Date 2019-09-25 11:30:34Z.
Comment 5 Buovjaga 2020-04-26 12:11:31 UTC
I installed perl-image-exiftool on Arch Linux and tested.

Create Date changes to 2019:09:25 20:30:34Z

This was observed with versions 3.3.0 and 4.4.7 as well.

Arch Linux 64-bit
Version: 7.0.0.0.alpha0+
Build ID: 6a9c7409ee617b79c327dd7ea4de432f448b6006
CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 24 April 2020
Comment 6 QA Administrators 2022-04-27 04:01:35 UTC Comment hidden (obsolete)
Comment 7 Nick Matteo 2022-04-28 03:19:08 UTC
I can confirm that the bug is still present in LibreOffice 7.3.2.2.

Help - About LibreOffice says:

Version: 7.3.2.2 / LibreOffice Community
Build ID: 49f2b1bff42cfccbd8f788c8dc32c1c309559be0
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

I verified that LibreOffice's behaviour depends on the local time zone (it adds -4 hours instead of -6 when I set TZ=America/New_York instead of TZ=America/Denver).

But it is still adding the offset when it should leave the time as-is, because it's already UTC. (Or possibly SUBTRACT, not add, the offset, if it's believed that the time in the .xls is local time, and it's desired to store UTC.)