Skip to content

Commit

Permalink
changelog2spec: fix time zone handling
Browse files Browse the repository at this point in the history
The new --timestampfile option writes the time stamp of the
first changes entry to the specified file. We wrote the wrong
time because we did the time zone compensation while parsing
the entry.

The commit moves the time zone compensation to the correct
place, i.e. when converting the time back to a string. Also,
we skip the compensation when the --fulltimestamps option
is given, as we always write UTC time stamps in that case.

(The purpose of the compensation is to use the time zone of
the first changes entry for all the following entry. It is
somewhat historic and we might drop it altogether in the future.)
  • Loading branch information
mlschroe committed Feb 8, 2024
1 parent dd4ae49 commit ad8accf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion changelog2spec
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ sub parse_suse {
$tdt = str2time("$year-1-1");
}
$tdt += 12 * 3600 unless $dt =~ /\d:\d/; # 12:00 if not specified
$tdt += ($zone || 0);
my $ok = 1;
my $change = '';
while(<>) {
Expand Down Expand Up @@ -267,6 +266,8 @@ while(defined($_)) {
}
$first_timestamp = $t unless defined $first_timestamp;
$lastt = $t;
# convert to time zone of first entry unless we want full UTC timestamps
$t += $zone if !$fulltimestamps && $zone;
my @gm = gmtime($t);
# silly rpm can't hande dates < 1997, so we fold everything to
# Thu Jan 02 1997
Expand Down

0 comments on commit ad8accf

Please sign in to comment.