X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/aabde5c5f0cba198c90558a3f3bb100ea9a09b6d..20fd0e67ddcbba8c4bc1e5e9c5e2def6eccd9d85:/services/api/lib/db_current_time.rb?ds=sidebyside diff --git a/services/api/lib/db_current_time.rb b/services/api/lib/db_current_time.rb index ef68b0d09a..80516521b4 100644 --- a/services/api/lib/db_current_time.rb +++ b/services/api/lib/db_current_time.rb @@ -1,7 +1,15 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + module DbCurrentTime - CURRENT_TIME_SQL = "SELECT CURRENT_TIMESTAMP" + CURRENT_TIME_SQL = "SELECT clock_timestamp()" def db_current_time Time.parse(ActiveRecord::Base.connection.select_value(CURRENT_TIME_SQL)).to_time end + + def db_transaction_time + Time.parse(ActiveRecord::Base.connection.select_value('SELECT current_timestamp')).to_time + end end