[Reproducible-commits] [strip-nondeterminism] 05/05: Use gmtime instead of localtime for normalizing timestamps

Andrew Ayer agwa at andrewayer.name
Thu Feb 5 18:22:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

agwa-guest pushed a commit to branch master
in repository strip-nondeterminism.

commit 2b6b28620bcd56158df2695e758cb3e71c1a34e4
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Thu Feb 5 10:21:14 2015 -0800

    Use gmtime instead of localtime for normalizing timestamps
    
    Otherwise we introduce non-determinism from the timezone!
---
 lib/File/StripNondeterminism/handlers/docbooktoman.pm | 2 +-
 lib/File/StripNondeterminism/handlers/javadoc.pm      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/File/StripNondeterminism/handlers/docbooktoman.pm b/lib/File/StripNondeterminism/handlers/docbooktoman.pm
index 2760409..d7c0f8e 100644
--- a/lib/File/StripNondeterminism/handlers/docbooktoman.pm
+++ b/lib/File/StripNondeterminism/handlers/docbooktoman.pm
@@ -36,7 +36,7 @@ sub normalize {
 	my $canonical_time = $File::StripNondeterminism::canonical_time // 0;
 
 	# Format is specified in docbook-to-man:Instant/main.c
-	my $timestamp = strftime('%a %d %b %Y, %R', localtime($canonical_time));
+	my $timestamp = strftime('%a %d %b %Y, %R', gmtime($canonical_time));
 
 	while (defined(my $line = <$fh>)) {
 		if ($line =~ s/(?<=^\.\\" created by instant \/ docbook-to-man, ).*/$timestamp/g) {
diff --git a/lib/File/StripNondeterminism/handlers/javadoc.pm b/lib/File/StripNondeterminism/handlers/javadoc.pm
index 88cf489..f9536df 100644
--- a/lib/File/StripNondeterminism/handlers/javadoc.pm
+++ b/lib/File/StripNondeterminism/handlers/javadoc.pm
@@ -50,7 +50,7 @@ sub normalize {
 			$modified = 1;
 		} elsif ($line =~ /\<META NAME="date" CONTENT="[^"]*"\>/i) {
 			if (defined $File::StripNondeterminism::canonical_time) {
-				my $date = strftime('%Y-%m-%d', localtime($File::StripNondeterminism::canonical_time));
+				my $date = strftime('%Y-%m-%d', gmtime($File::StripNondeterminism::canonical_time));
 				$line =~ s/\<(META NAME="date" CONTENT)="[^"]*"\>/<$1="$date">/gi;
 			} else {
 				$line =~ s/\<META NAME="date" CONTENT="[^"]*"\>//gi;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git



More information about the Reproducible-commits mailing list