# Following is similar to AUTO_LOGIN setting above, and must be set.
<<!PUBLIC_LOGIN<admin/admin>
<<TIME_ZONE_MAP<
-Marsfield=Australia/Sydney
-Bondi=Australia/Sydney
+Australia/Marsfield=Australia/Sydney
+Australia/Bondi=Australia/Sydney
+America/Austin=America/Chicago
America/Texas=America/Chicago
>>
sub setTimezone {
my $ret = shift;
+ my $to = shift; #optional for testing purposes.
my $v= $anons{'TIME_ZONE_MAP'};
if($v){
if(!%tz_map){
%tz_map={}; chomp($v);
- foreach (split('\n')){
+ foreach (split('\n',$v)){
my @p = split('=', $_);
$tz_map{trim($p[0])} = trim($p[1]);
}
}
- $v = $tz_map{$TIME_ZONE}; #will be set in config to either valid or mapped.
+ if($to){$v = $tz_map{$to};}else{$v = $tz_map{$TIME_ZONE};}
if($v){$TIME_ZONE=$v}
}
$ret = DateTime->now() if(!$ret);
- $ret -> set_time_zone($TIME_ZONE) ;
+ $ret -> set_time_zone($TIME_ZONE);
return $ret;
}
my $cnf = CNFParser->new($ENV{'PWD'}.'/dbLifeLog/main.cnf');
my $ptr = $cnf->anons();
Settings::anonsSet($ptr);
-
-my $time = Settings::today();
+my $time = Settings::today();
+my $cnf_tz = Settings::timezone();
+my $ret = Settings::setTimezone(undef, 'America/Texas');
my $a = Settings::anon('TIME_ZONE_MAP');
-print $time, $a , "\n";
+
+print "tz:".$cnf_tz." time:". $time. "\n", $a , "\n\nTime America/Texas:$ret\n";
1;
\ No newline at end of file