My web app stores all timestamps in UTC without time zones. I have a shell/psql script that returns a list of recent logins, and I want that script to display login times in
SELECT current_setting('TIMEZONE')
This can be used in a query, however, this does not give a numerical difference.
Your solution is fine.
To get # of seconds difference as an integer, I have used simply:
select extract( timezone from now() );