From 615cfb88c1aae1f8372b323e9c53a84d8c9146fe Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 27 Aug 2008 07:32:11 +0000 Subject: Bug 182238: Allow users to choose what time zone to display times in - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index abba18924..ba3e75d89 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -51,6 +51,7 @@ use Bugzilla::Flag; use File::Basename; use File::Spec::Functions; +use DateTime::TimeZone; use Safe; # This creates the request cache for non-mod_perl installations. @@ -463,6 +464,16 @@ sub hook_args { return $class->request_cache->{hook_args}; } +sub local_timezone { + my $class = shift; + + if (!defined $class->request_cache->{local_timezone}) { + $class->request_cache->{local_timezone} = + DateTime::TimeZone->new(name => 'local'); + } + return $class->request_cache->{local_timezone}; +} + sub request_cache { if ($ENV{MOD_PERL}) { require Apache2::RequestUtil; @@ -699,4 +710,10 @@ is unreadable or is not valid perl, we C. If you are running inside a code hook (see L) this is how you get the arguments passed to the hook. +=item C + +Returns the local timezone of the Bugzilla installation, +as a DateTime::TimeZone object. This detection is very time +consuming, so we cache this information for future references. + =back -- cgit v1.2.3-24-g4f1b