Ruby on Rails: is it possible to query the current time from a SQL server?

In a previous question about overriding Time.now, I worked on a solution to falsify clock synchronization on all machines connected to a given database. Overriding Time.now seemed like the best way for the approach I was taking, however:

It seems I could get the result I got after a simpler line. If I can get the current SQL Server time, my life will be much easier.

On every machine, I can do something like; Create a record, check create_time in Record, Record delete, but if there is something simpler, I'll take it.

I've seen SELECT GETDATE () (oracle) and SELECT NOW () (mysql) and similar forms. People who are looking at my code are unlikely to like direct calls. I really need something across the rails - if it exists.

0


source to share


1 answer


SELECT GetDate () will give the current time from SQL Server



+2


source







All Articles