summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-08-27 09:32:11 +0200
committerlpsolit%gmail.com <>2008-08-27 09:32:11 +0200
commit615cfb88c1aae1f8372b323e9c53a84d8c9146fe (patch)
treed41bf992b9de42c29141e41714b6108866a39204 /Bugzilla.pm
parent68c8ee64ec7dc985931f17f98cb83ee153dcd25c (diff)
downloadbugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.gz
bugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.xz
Bug 182238: Allow users to choose what time zone to display times in - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm17
1 files changed, 17 insertions, 0 deletions
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<die>.
If you are running inside a code hook (see L<Bugzilla::Hook>) this
is how you get the arguments passed to the hook.
+=item C<local_timezone>
+
+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