From 615cfb88c1aae1f8372b323e9c53a84d8c9146fe Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 27 Aug 2008 07:32:11 +0000 Subject: =?UTF-8?q?Bug=20182238:=20Allow=20users=20to=20choose=20what=20ti?= =?UTF-8?q?me=20zone=20to=20display=20times=20in=20-=20Patch=20by=20Fr?= =?UTF-8?q?=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r?= =?UTF-8?q?/a=3Dmkanat?= 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.1