X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FContext.pm;h=9ce6c74914bc89fd376d11fa5d3475ab1481fdab;hb=cec20df6d9a863d9ee33c670970b37f62d508280;hp=0417c45075341cad9ef1091424e3a364f3202f1a;hpb=6a520f7456001d014776c33409262c68a5c2f9ae;p=koha_fer diff --git a/C4/Context.pm b/C4/Context.pm index 0417c45075..9ce6c74914 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -95,7 +95,7 @@ BEGIN { $ismemcached = $memcached->set('ismemcached','1'); } - $VERSION = '3.00.00.036'; + $VERSION = '3.07.00.049'; } use DBI; @@ -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__