Project

General

Profile

Actions

Bug #93830

open

Wrong type for field `time_micro` in table `sys_log`

Added by Stefano Kowalke over 2 years ago. Updated over 1 year ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
Start date:
2021-03-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
database, logging,
Complexity:
no-brainer
Is Regression:
Sprint Focus:
Remote Sprint

Description

As we log some custom events to `sys_log` we installed the log extension https://gitlab.com/co-stack.com/co-stack.com/typo3-extensions/logs mentioned at https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Logging/Writers/Index.html.

The backend module sorts the log entries by the field `time_micro` of the table `sys_log`. However, the entries in this field getting stored not correctly because the type is defined as `float`
(https://github.com/TYPO3/TYPO3.CMS/blob/650d5d7ba771d2ad854f2475b7b7d4aff70c9d2c/typo3/sysext/core/ext_tables.sql#L384). While the real microtime in PHP was something like `1617029996.5212` I got `1617030000` in all records:

Changing the type to `decimal(14,4)` fixed the issue.


Files

2021-03-29_16-54-01.png (195 KB) 2021-03-29_16-54-01.png Stefano Kowalke, 2021-03-29 15:21
Actions #1

Updated by Stefano Kowalke over 2 years ago

  • Tags changed from database to database, logging,
  • Complexity set to no-brainer
Actions #2

Updated by Martin Kutschker over 2 years ago

Seems to be some kind of rounding issue.

Ideally we had a portable SQL date field that has microseconds.

Actions #3

Updated by Mathias Schreiber almost 2 years ago

  • Sprint Focus set to Remote Sprint
Actions #4

Updated by Andreas Kienast over 1 year ago

  • Status changed from New to Needs Feedback

Hello Stefano,

can you please tell which database you're using and if this is still an issue? We were not able to reproduce the issue in v11 and v12 with MySQL 5.7 and MariaDB 10.2 with passing microtime(true).

Actions #5

Updated by Stefano Kowalke over 1 year ago

As I am not on that project anymore, I can't help about the current state of this issue. All I can say, that it happened with v10 and MariaDB. Maybe Sebastian Michaelsen can jump in here.

Actions

Also available in: Atom PDF