X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FContext.pm;h=67d31ee94788119266856e543f368caa021e64d3;hb=2bc542789fdf9d551a408bc8349daa062a37c496;hp=0417c45075341cad9ef1091424e3a364f3202f1a;hpb=a7f7aeb138b8275448937102cb7a46cf49530aef;p=koha_gimpoz diff --git a/C4/Context.pm b/C4/Context.pm index 0417c45075..67d31ee947 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -104,6 +104,7 @@ use XML::Simple; use C4::Boolean; use C4::Debug; use POSIX (); +use DateTime::TimeZone; =head1 NAME @@ -384,6 +385,7 @@ sub new { $self->{"userenv"} = undef; # User env $self->{"activeuser"} = undef; # current active user $self->{"shelves"} = undef; + $self->{tz} = undef; # local timezone object bless $self, $class; return $self; @@ -1112,6 +1114,24 @@ sub get_versions { } +=head2 tz + + C4::Context->tz + + Returns a DateTime::TimeZone object for the system timezone + +=cut + +sub tz { + my $self = shift; + if (!defined $context->{tz}) { + $context->{tz} = DateTime::TimeZone->new(name => 'local'); + } + return $context->{tz}; +} + + + 1; __END__