X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/44823f311ea0328c3a2aeefb7208a74031436d52..c3872e7a1c817cd39b702f694f70d34f28f7f472:/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 b4a6423546..2d58e3c389 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 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 + ActiveRecord::Base.connection.select_value(CURRENT_TIME_SQL) + end + + def db_transaction_time + ActiveRecord::Base.connection.select_value("SELECT current_timestamp AT TIME ZONE 'UTC'") end end