Bug #95775 Version 5.6 has the wrong format for slow logging time
Submitted: 13 Jun 2019 2:13 Modified: 13 Jun 2019 5:57
Reporter: kfpanda kf Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[13 Jun 2019 2:13] kfpanda kf
Description:
There is a problem with the time output format of the following code in the function MYSQL_QUERY_LOG::write.

----------------

        buff_len= my_snprintf(buff, sizeof buff,
                              "# Time: %02d%02d%02d %2d:%02d:%02d\n",
                              start.tm_year % 100, start.tm_mon + 1,
                              start.tm_mday, start.tm_hour,
                              start.tm_min, start.tm_sec);

----------------

You will find that the output format of hours is %2d, the correct should be %02d.

How to repeat:
There is a problem with the time output format of the following code in the function MYSQL_QUERY_LOG::write.

----------------

        buff_len= my_snprintf(buff, sizeof buff,
                              "# Time: %02d%02d%02d %2d:%02d:%02d\n",
                              start.tm_year % 100, start.tm_mon + 1,
                              start.tm_mday, start.tm_hour,
                              start.tm_min, start.tm_sec);

----------------

You will find that the output format of hours is %2d, the correct should be %02d.

Suggested fix:
There is a problem with the time output format of the following code in the function MYSQL_QUERY_LOG::write.

----------------

        buff_len= my_snprintf(buff, sizeof buff,
                              "# Time: %02d%02d%02d %2d:%02d:%02d\n",
                              start.tm_year % 100, start.tm_mon + 1,
                              start.tm_mday, start.tm_hour,
                              start.tm_min, start.tm_sec);

----------------

You will find that the output format of hours is %2d, the correct should be %02d.
[13 Jun 2019 5:57] MySQL Verification Team
Hello!

Thank you for the report.

Thanks,
Umesh