Skip to content

1292: Truncated incorrect time value: '21194:51:14' #101

@TheRoby

Description

@TheRoby

  • Version of the plugin :
    2.0.0

  • Version of your GLPI :
    10.0.10

  • Steps to reproduce (which actions have you made) :
    nothing, just wait

  • Expected result :
    no warning in sql-errors.log :)

  • Actual result :
    Warnings:
    1292: Truncated incorrect time value: '21194:51:14'
    1292: Truncated incorrect time value: '20113:10:31'
    1292: Truncated incorrect time value: '21193:20:39'

  • URL of the page :
    [2023-10-10 13:00:02] glpisqllog.WARNING: DBmysql::query() in /var/www/glpi/src/DBmysql.php line 419
    *** MySQL query warnings:
    SQL: SELECT glpi_plugin_printercounters_records.id as records_id,
    glpi_plugin_printercounters_items_recordmodels.items_id,
    glpi_printers.name as items_name,
    glpi_plugin_printercounters_items_recordmodels.enable_automatic_record,
    glpi_plugin_printercounters_items_recordmodels.active_mutex,
    TIME_TO_SEC(TIMEDIFF(NOW(),glpi_plugin_printercounters_items_recordmodels.active_mutex)) as mutex_delay,
    max(glpi_plugin_printercounters_records.date) as last_record,
    glpi_entities.name as entities_name,
    glpi_plugin_printercounters_items_recordmodels.periodicity as periodicity_seconds,
    (glpi_plugin_printercounters_items_recordmodels.periodicity/24/3600) as periodicity,
    TIME_TO_SEC(TIMEDIFF(HOUR,NOW(),max(glpi_plugin_printercounters_records.date))) as delay,
    glpi_plugin_printercounters_items_recordmodels.status as status
    FROM glpi_plugin_printercounters_items_recordmodels
    LEFT JOIN glpi_plugin_printercounters_records
    ON (glpi_plugin_printercounters_records.plugin_printercounters_items_recordmodels_id = glpi_plugin_printercounters_items_recordmodels.id)
    LEFT JOIN glpi_entities
    ON (glpi_plugin_printercounters_records.entities_id = glpi_entities.id)
    INNER JOIN glpi_printers
    ON (glpi_plugin_printercounters_items_recordmodels.items_id = glpi_printers.id)
    WHERE LOWER(glpi_plugin_printercounters_items_recordmodels.itemtype) = LOWER('Printer')
    AND glpi_printers.is_deleted = 0 AND glpi_plugin_printercounters_items_recordmodels.items_id % 4 = 3 GROUP BY glpi_plugin_printercounters_items_recordmodels.items_id


Because the TIMEDIFF function returns a TIME value, its result is limited to the range allowed for TIME values which is from -838:59:59 to 838:59:59.

So, if you have a printer with an old record, you have warning in your sql-errors.log

I don't know to what the delay is needed

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions