1 From 69faba79256faeee8d564298855eebe8c5e9c870 Mon Sep 17 00:00:00 2001
2 From: Colin Watson <cjwatson@debian.org>
3 Date: Fri, 6 Nov 2015 11:40:37 +0000
4 Subject: Always use UTC times for display
6 Using localtime is problematic for reproducible builds. For now, always
7 use UTC times (gmtime etc.) for display. (Note that this changes the
8 semantics of \n[hours] etc., so may need further work.)
11 Last-Update: 2018-03-05
13 Patch-Name: display-utc-times.patch
15 src/devices/grohtml/post-html.cpp | 4 ++--
16 src/devices/gropdf/gropdf.pl | 4 ++--
17 src/devices/grops/ps.cpp | 2 +-
18 src/roff/troff/input.cpp | 2 +-
19 4 files changed, 6 insertions(+), 6 deletions(-)
21 diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp
22 index 7bc017e0..ad7ca54f 100644
23 --- a/src/devices/grohtml/post-html.cpp
24 +++ b/src/devices/grohtml/post-html.cpp
25 @@ -5016,7 +5016,7 @@ void html_printer::do_file_components (void)
28 html.begin_comment("CreationDate: ")
29 - .put_string(ctime(&t), strlen(ctime(&t))-1)
30 + .put_string(asctime(gmtime(&t)), strlen(asctime(gmtime(&t)))-1)
34 @@ -5129,7 +5129,7 @@ html_printer::~html_printer()
37 html.begin_comment("CreationDate: ")
38 - .put_string(ctime(&t), strlen(ctime(&t))-1)
39 + .put_string(asctime(gmtime(&t)), strlen(asctime(gmtime(&t)))-1)
43 diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
44 index 2ec52d06..134b0962 100644
45 --- a/src/devices/gropdf/gropdf.pl
46 +++ b/src/devices/gropdf/gropdf.pl
47 @@ -280,7 +280,7 @@ elsif (exists($ppsz{$papersz}))
48 @defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]);
51 -my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time);
52 +my (@dt)=gmtime($ENV{SOURCE_DATE_EPOCH} || time);
55 my %info=('Creator' => "(groff version $cfg{GROFF_VERSION})",
56 @@ -538,7 +538,7 @@ sub GetObj
60 - return(sprintf("D:%04d%02d%02d%02d%02d%02d%+03d'00'",$dt->[5]+1900,$dt->[4]+1,$dt->[3],$dt->[2],$dt->[1],$dt->[0],( localtime time() + 3600*( 12 - (gmtime)[2] ) )[2] - 12));
61 + return(sprintf("D:%04d%02d%02d%02d%02d%02d+00'00'",$dt->[5]+1900,$dt->[4]+1,$dt->[3],$dt->[2],$dt->[1],$dt->[0]));
65 diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
66 index ab3b1d73..b0fb78e1 100644
67 --- a/src/devices/grops/ps.cpp
68 +++ b/src/devices/grops/ps.cpp
69 @@ -1392,7 +1392,7 @@ ps_printer::~ps_printer()
73 - fputs(ctime(&t), out.get_file());
74 + fputs(asctime(gmtime(&t)), out.get_file());
76 for (font_pointer_list *f = font_list; f; f = f->next) {
77 ps_font *psf = (ps_font *)(f->p);
78 diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
79 index a1bd8eaf..f415aa6d 100644
80 --- a/src/roff/troff/input.cpp
81 +++ b/src/roff/troff/input.cpp
82 @@ -8084,7 +8084,7 @@ static void init_registers()
83 #endif /* not LONG_FOR_TIME_T */
85 // Use struct here to work around misfeature in old versions of g++.
86 - struct tm *tt = localtime(&t);
87 + struct tm *tt = gmtime(&t);
88 set_number_reg("seconds", int(tt->tm_sec));
89 set_number_reg("minutes", int(tt->tm_min));
90 set_number_reg("hours", int(tt->tm_hour));