use FindBin;
use Encode qw( decode_utf8 encode_utf8 );
use Data::Dump;
+use DateTime;
use Carp;
return $_[0]->logger;
}
+#-----------------------------------------
+
+has 'local_timezone' => (
+ is => 'ro',
+ isa => 'FrBr::Types::TimeZone',
+ traits => [ 'NoGetopt' ],
+ lazy => 1,
+ builder => '_build_local_timezone',
+ documentation => 'Die lokale Zeitzone als DateTime::TimeZone-Objekt.',
+);
+
+sub _build_local_timezone {
+ return DateTime::TimeZone->new( name => 'local' );
+}
+
#############################################################################################
# Ändern der Eigenschaften einiger geerbter Attribute
$self->debug( "Initialisierung beginnt ..." ) if $self->verbose >= 2;
+ if ( $self->verbose >= 2 ) {
+
+ my $tmp;
+
+ for my $f ( 'local_timezone' ) {
+ $tmp = $self->$f();
+ }
+
+ }
+
}
#---------------------------------
'dec' => 12,
};
-our $LocalTZ = DateTime::TimeZone->new( name => 'local' );
+#our $LocalTZ = DateTime::TimeZone->new( name => 'local' );
############################################################################
return dir->new( '/' );
}
+#-------------------------
+
+=head2 ftp_remote_timezone
+
+Zeitzone auf dem FTP-Server
+
+=cut
+
+has 'ftp_remote_timezone' => (
+ is => 'rw',
+ isa => 'FrBr::Types::TimeZone',
+ traits => [ 'Getopt' ],
+ coerce => 1,
+ lazy => 1,
+ required => 1,
+ builder => '_build_ftp_remote_timezone',
+ documentation => 'Die Zeitzine auf dem FTP-Server',
+ cmd_flag => 'ftp-remote-timezone',
+ cmd_aliases => [ 'remote-timezone' ],
+);
+
+#------
+
+sub _build_ftp_remote_timezone {
+ return DateTime::TimeZone->new( name => 'UTC' );
+}
+
############################################################################
=head1 METHODS
$self->debug( "Werte FTP-Konfigurationsdinge aus ..." );
return unless $self->config and keys %{ $self->config };
- my @ConfigKeys = qw( host user password blocksize port timeout passive hash_size local_dir remote_dir );
+ my @ConfigKeys = qw( host user password blocksize port timeout passive hash_size local_dir remote_dir remote_timezone );
for my $key ( keys %{ $self->config } ) {
return if $self->app_initialized;
$self->debug( "Initialisiere ..." );
- $self->debug( "Lokale Zeitzone: ", $LocalTZ );
+ #$self->debug( "Lokale Zeitzone: ", $LocalTZ );
if ( $self->verbose >= 2 ) {
for my $f ( 'ftp_connected', 'ftp_auto_login', 'ftp_auto_init', 'ftp_host',
'ftp_user', 'ftp_password', 'ftp_blocksize', 'ftp_port',
'ftp_timeout', 'ftp_passive', 'ftp_hash_size', 'ftp_local_dir',
- 'ftp_remote_dir', ) {
+ 'ftp_remote_dir', 'ftp_remote_timezone', ) {
$tmp = $self->$f();
}
$entry->{'name'} = $name;
-# my $file_dt = $Strp->parse_datetime($mtime_str);
-# if ( $file_dt ) {
-# $self->debug( sprintf( "Dateidatum von '%s': %s" ), $name, $file_dt->strftime('%Y-%m-%d %H:%M:%S') ) if $self->verbose >= 3;
-# while ( DateTime->compare( $file_dt, $now ) > 0 ) {
-# $file_dt->subtract( 'years' => 1 );
-# $self->debug( sprintf( "Dateidatum von '%s': %s" ), $name, $file_dt->strftime('%Y-%m-%d %H:%M:%S') ) if $self->verbose >= 3;
-# }
-# }
-
push @$list, $entry;
}
return undef;
}
- my $now = DateTime->now()->set_time_zone( $LocalTZ );
+ my $now = DateTime->now()->set_time_zone( $self->local_timezone );
my $this_year = $now->year;
my $create_hash = {
hour => $hour + 0,
minute => $minute + 0,
second => 0,
- time_zone => 'UTC',
+ time_zone => $self->ftp_remote_timezone,
};
$self->debug( "Erstelle DateTime-Objekt aus folgenden Angaben: ", $create_hash ) if $self->verbose >= 3;