Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Honour SOURCE_DATE_EPOCH for embedded timestamp
 When the environment variable SOURCE_DATE_EPOCH is set, use it instead of the
 current time for the embedded build timestamp.
 .
 The specification of SOURCE_DATE_EPOCH is available here:
 https://reproducible-builds.org/specs/source-date-epoch/
 .
 In the case it is not defined, fall back to current time in UTC.
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=115614
Bug: https://rt.cpan.org/Ticket/Display.html?id=115614

--- a/inc/Marpa/R2/Build_Me.pm
+++ b/inc/Marpa/R2/Build_Me.pm
@@ -83,7 +83,7 @@
 
 ##no critic(ValuesAndExpressions::RequireInterpolationOfMetachars)
     $text .= q{use vars qw($TIMESTAMP)} . qq{;\n};
-    $text .= q{$TIMESTAMP='} . localtime()->datetime . qq{';\n};
+    $text .= q{$TIMESTAMP='} . (gmtime($ENV{SOURCE_DATE_EPOCH} || time()))->datetime . qq{';\n};
 ##use critic
 
     for my $package (@use_packages) {
@@ -104,7 +104,7 @@
 
 ##no critic(ValuesAndExpressions::RequireInterpolationOfMetachars)
     $text .= q{use vars qw($TIMESTAMP)} . qq{;\n};
-    $text .= q{$TIMESTAMP='} . localtime()->datetime . qq{';\n};
+    $text .= q{$TIMESTAMP='} . (gmtime($ENV{SOURCE_DATE_EPOCH} || time()))->datetime . qq{';\n};
 ##use critic
 
     for my $package (@use_packages) {
