Bug #90132 now() and sysdate() returns zero time when before 10 am local time
Submitted: 19 Mar 2018 23:02 Modified: 20 Mar 2018 16:20
Reporter: Alex Yanovsky Email Updates:
Status: Closed Impact on me:
None 
Category:Shell General / Core Client Severity:S2 (Serious)
Version:1.0.11 OS:Windows (got the same issue on Windows 7, and 10)
Assigned to: CPU Architecture:x86 (64-bit)
Tags: system time

[19 Mar 2018 23:02] Alex Yanovsky
Description:
When running now() or sysdate() before 10 am local time seeing time part all zeroes. After 10 am it shows time normally. Have several MySQL 5.7 installations on Windows 7 and on Windows 10 - see the same pattern. 
This is how it looks, as I was running it just before 10 am: 

mysql-sql> select curtime(); 
+-----------+ 
| curtime() | 
+-----------+ 
| 09:59:39 | 
+-----------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+--------------------+ 
| now() | 
+--------------------+ 
| 2018-03-16 0:00:00 | 
+--------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+--------------------+ 
| now() | 
+--------------------+ 
| 2018-03-16 0:00:00 | 
+--------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+--------------------+ 
| now() | 
+--------------------+ 
| 2018-03-16 0:00:00 | 
+--------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+--------------------+ 
| now() | 
+--------------------+ 
| 2018-03-16 0:00:00 | 
+--------------------+ 
1 row in set (0.00 sec) 

mysql-sql> select now(); 
+--------------------+ 
| now() | 
+--------------------+ 
| 2018-03-16 0:00:00 | 
+--------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+--------------------+ 
| now() | 
+--------------------+ 
| 2018-03-16 0:00:00 | 
+--------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+---------------------+ 
| now() | 
+---------------------+ 
| 2018-03-16 10:00:01 | 
+---------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select now(); 
+---------------------+ 
| now() | 
+---------------------+ 
| 2018-03-16 10:00:03 | 
+---------------------+ 
1 row in set (0.00 sec) 
mysql-sql> select curtime(); 
+-----------+ 
| curtime() | 
+-----------+ 
| 10:00:13 | 
+-----------+ 
1 row in set (0.00 sec) 
mysql-sql>

How to repeat:
I use MySQL Shell which was installed together with the server using the same installer file
mysql-installer-community-5.7.18.1.msi
It gives me the same zero result time any time I do it before 10 am.

Don't know if it is specific to my computers - I tried on 3 PC's 
always having server running locally as a service on the same localhost.

I tried time() command in the system command line (cmd window) - it always gives me correct result,
but before 10 am, it returns just one digit for hours, like 9:59:39

Was searching on the net ffor such issue, but could not find any mention about it. Posted on Newbie forum afew days ago, got no response.
[20 Mar 2018 10:19] MySQL Verification Team
Hello Alex Yanovsky,

Thank you for the report.
Observed this with MySQL Shell 1.0.11.

Thanks,
Umesh
[20 Mar 2018 15:52] Alfredo Kojima
Posted by developer:
 
This issue was fixed in the shell 8.0 series and can no longer be reproduced.
[20 Mar 2018 16:03] Alfredo Kojima
Please try mysql shell 8.0.4 or later.
[20 Mar 2018 16:16] Alex Yanovsky
Thanks a lot.
Understood.
So it is only specific to shell?
I was also using JDBC doing something like
insert into my_table(my_date) values (sysdate());
and seeing zero time in the table.
But, true, when I was checking using printing out the table in the  same MySQL shell.
Well, if it is about shell, then it is not so important.
Thanks.