Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not the person to whom you're replying, but I suspect the problem isn't that the database is using NOW(), but that your code being tested will be using an entirely different time.


Bingo.

There is nothing wrong with using NOW(), in of itself, and it maybe the best thing to do.

But it may lead to surprising results when say you have an application that has mocked out time for a specific time, but you get db results for the current time. It introduces another clock into your system.

I have found most of the time we were using NOW() we could pass the time into the query and create a more understandable chain of code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: