Use local time.
Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
parent
d28ca61a32
commit
585f877bd2
2 changed files with 14 additions and 8 deletions
|
|
@ -238,7 +238,7 @@ sub ParseDate {
|
|||
return DateTime->new(year => $Year,
|
||||
month => $Month,
|
||||
day => $Day,
|
||||
);
|
||||
)->set_time_zone('local');
|
||||
}
|
||||
|
||||
### ------------------------------------------------------------------
|
||||
|
|
@ -377,6 +377,9 @@ sub BuildPosting {
|
|||
return '';
|
||||
}
|
||||
|
||||
# today (TD)
|
||||
my $TD = DateTime->now->set_time_zone('local');
|
||||
|
||||
# read status file, if available
|
||||
my($LastPosted, $LastMID);
|
||||
if (-r $StatusFile) {
|
||||
|
|
@ -409,7 +412,7 @@ sub BuildPosting {
|
|||
}
|
||||
|
||||
# add Date:
|
||||
push @Headers, 'Date: ' . DateTime->now->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n";
|
||||
push @Headers, 'Date: ' . $TD->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n";
|
||||
# add missing Message-ID:
|
||||
push @Headers, 'Message-ID: <%n-%y-%m-%d@' . hostfqdn. ">\n" if (!$Header{'message-id'});
|
||||
# add User-Agent
|
||||
|
|
@ -462,9 +465,9 @@ sub BuildPosting {
|
|||
# %d current day
|
||||
# %p PID
|
||||
if (/^Message-ID: /i) {
|
||||
my $TDY = DateTime->now->strftime('%Y');
|
||||
my $TDM = DateTime->now->strftime('%m');
|
||||
my $TDD = DateTime->now->strftime('%d');
|
||||
my $TDY = $TD->strftime('%Y');
|
||||
my $TDM = $TD->strftime('%m');
|
||||
my $TDD = $TD->strftime('%d');
|
||||
$_ =~ s/\%n/$Project/g;
|
||||
$_ =~ s/\%y/$TDY/g;
|
||||
$_ =~ s/\%m/$TDM/g;
|
||||
|
|
@ -481,7 +484,9 @@ sub BuildPosting {
|
|||
chomp;
|
||||
$_ =~ s/^Expires:\s+//;
|
||||
die "E: Illegal 'Expires: $_' in '$HeaderFile'.\n" if ($_ !~ /^\d+[dwmy]$/);
|
||||
$_ = 'Expires: ' . &AddDuration(DateTime->now,$_)->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n";
|
||||
$_ = 'Expires: ' . &AddDuration($TD,$_)->strftime('%a, %d %b %Y %H:%M:%S %z') . "\n";
|
||||
# reset TD (changed by AddDuration)
|
||||
$TD = DateTime->now->set_time_zone('local');
|
||||
}
|
||||
# add Supersedes: if set
|
||||
if (/^Supersedes: /) {
|
||||
|
|
@ -518,7 +523,7 @@ sub BuildPosting {
|
|||
|
||||
# check if posting is due
|
||||
print "- Posting has been forced.\n" if $Config{'debug'} && $OptForce;
|
||||
if ($OptForce or (!$LastPosted) or ($LastPosted && $NextPosted <= DateTime->now)) {
|
||||
if ($OptForce or (!$LastPosted) or ($LastPosted && $NextPosted <= $TD)) {
|
||||
print "... is due and will be posted.\n" if $Config{'verbose'} or $Config{'debug'};
|
||||
} else {
|
||||
printf("... is not due (next post at %s).\n", $NextPosted->strftime('%Y-%m-%d'))
|
||||
|
|
@ -569,7 +574,7 @@ sub UpdateStatus {
|
|||
my $StatusFile = $Config{'datadir'} . "$Project.cfg";
|
||||
my @Status;
|
||||
|
||||
push @Status, "Last-Posted: " . DateTime->now->strftime('%Y-%m-%d') . "\n";
|
||||
push @Status, "Last-Posted: " . DateTime->now->set_time_zone('local')->strftime('%Y-%m-%d') . "\n";
|
||||
push @Status, "Last-Message-ID: $LastMID\n";
|
||||
|
||||
$StatusFile = path($StatusFile);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue