X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/20fd0e67ddcbba8c4bc1e5e9c5e2def6eccd9d85..79bce4a71a58118a9003882e0ca9bbfb9d2957a9:/services/api/lib/db_current_time.rb diff --git a/services/api/lib/db_current_time.rb b/services/api/lib/db_current_time.rb index 80516521b4..5e1634ecb9 100644 --- a/services/api/lib/db_current_time.rb +++ b/services/api/lib/db_current_time.rb @@ -3,13 +3,13 @@ # SPDX-License-Identifier: AGPL-3.0 module DbCurrentTime - CURRENT_TIME_SQL = "SELECT clock_timestamp()" + CURRENT_TIME_SQL = "SELECT clock_timestamp() AT TIME ZONE 'UTC'" def db_current_time - Time.parse(ActiveRecord::Base.connection.select_value(CURRENT_TIME_SQL)).to_time + Time.parse(ActiveRecord::Base.connection.select_value(CURRENT_TIME_SQL) + " +0000") end def db_transaction_time - Time.parse(ActiveRecord::Base.connection.select_value('SELECT current_timestamp')).to_time + Time.parse(ActiveRecord::Base.connection.select_value("SELECT current_timestamp AT TIME ZONE 'UTC'") + " +0000") end end