X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FContext.pm;h=67d31ee94788119266856e543f368caa021e64d3;hb=0a44448bfb4a46c069889319136bece143841dbc;hp=0417c45075341cad9ef1091424e3a364f3202f1a;hpb=734c63222bf807200c1b7bd4dbdcf4f12acd2db9;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__