Skip to content

Commit ad8accf

Browse files
committed
changelog2spec: fix time zone handling
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.)
1 parent dd4ae49 commit ad8accf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

changelog2spec

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ sub parse_suse {
156156
$tdt = str2time("$year-1-1");
157157
}
158158
$tdt += 12 * 3600 unless $dt =~ /\d:\d/; # 12:00 if not specified
159-
$tdt += ($zone || 0);
160159
my $ok = 1;
161160
my $change = '';
162161
while(<>) {
@@ -267,6 +266,8 @@ while(defined($_)) {
267266
}
268267
$first_timestamp = $t unless defined $first_timestamp;
269268
$lastt = $t;
269+
# convert to time zone of first entry unless we want full UTC timestamps
270+
$t += $zone if !$fulltimestamps && $zone;
270271
my @gm = gmtime($t);
271272
# silly rpm can't hande dates < 1997, so we fold everything to
272273
# Thu Jan 02 1997

0 commit comments

Comments
 (0)