Skip to content

Instantly share code, notes, and snippets.

@CampingScorpion
Created September 17, 2014 00:02
Show Gist options
  • Save CampingScorpion/861300fc3c2c460b6629 to your computer and use it in GitHub Desktop.
Save CampingScorpion/861300fc3c2c460b6629 to your computer and use it in GitHub Desktop.
(defn set-default-timezone
"Why: because when we read the data out of Redshift, the java.sql.Timestamps
that are retrieved will pickup the (TimeZone/getDefault).
This kind of thing must also be done in any reporting that pulls this data.
At which time should be calling to that production code instead of this test
setup HACK."
[test-fn]
(let [original-tz (TimeZone/getDefault)]
(try
(TimeZone/setDefault (TimeZone/getTimeZone "UTC"))
(test-fn)
(finally
(TimeZone/setDefault original-tz)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment