in reply to Re^3: How to get TZ difference?
in thread How to get TZ difference?

perl -e 'print ( ( (localtime)[2] - (gmtime)[2] + 12 ) % 24 - 12 )' across midnight, end of month, etc without all those pesky conditionals. Works because perl has a useful definition of modulo operator (%) for negative operands, but beware this can be compromised in certain situations. See perlop#Multiplicative-Operators.