diff options
author | lpsolit%gmail.com <> | 2008-08-27 07:32:11 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-08-27 07:32:11 +0000 |
commit | 615cfb88c1aae1f8372b323e9c53a84d8c9146fe (patch) | |
tree | d41bf992b9de42c29141e41714b6108866a39204 /Bugzilla.pm | |
parent | Fix bustage due to bug 446327 - Patch by me, r=mkanat (diff) | |
download | bugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.gz bugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.bz2 bugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.zip |
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.pm | 17 |
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 |