When I do a query for NOW() mysql returns a time that is off by roughly -30 seconds from the current time on the server. Any ideas? I tried looking through the config file and found nothing. I’m running version 5.1.37
SELECT NOW()
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The timezone contexts of the server and the context where you are getting the date almost certainly have a different view on the presence of leap seconds. I suspect that the difference will be 24s rather than 30s.
You can test this by adjusting the timezone when you get the date. On various Unixes, you can use the “right/” prefix on the timezone to adjust for leap seconds and seeing how that changes things.
To fix it, you need to make sure that the server runs with the timezone environment variable set correctly.
Update:
Missed the “windows” tag. Windows time is defined to be UTC rather than TAI and so has leap seconds included. If the difference is really 24s, then you need to check that mysql is not applying a leap second adjustments as well as Windows.