Author: Ralf Treinen <treinen@debian.org>
Description: use date from the debian changelog entry
Forwarded: https://github.com/coq/coq/issues/11265

Index: coq/configure.ml
===================================================================
--- coq.orig/configure.ml	2019-12-22 16:21:44.978750759 +0100
+++ coq/configure.ml	2019-12-22 16:21:44.978750759 +0100
@@ -199,19 +199,19 @@
 (** The short one is displayed when starting coqtop,
     The long one is used as compile date *)

-let months =
- [| "January";"February";"March";"April";"May";"June";
-    "July";"August";"September";"October";"November";"December" |]
+let get_date_debian () =
+  let scanline = "LC_ALL=C LANG=C dpkg-parsechangelog -S date"
+  and formatlong  = "date --file=- +\"%b %d %Y %H:%M:%S\""
+  and formatshort = "date --file=- +\"%B %Y\""
+  in (
+      (let oc = Unix.open_process_in (scanline ^ "|" ^ formatshort) in
+       let s = input_line oc in close_in oc; s)
+    ,
+      (let oc = Unix.open_process_in (scanline ^ "|" ^ formatlong) in
+       let s = input_line oc in close_in oc; s)
+    )

-let get_date () =
-  let now = Unix.localtime (Unix.time ()) in
-  let year = 1900+now.Unix.tm_year in
-  let month = months.(now.Unix.tm_mon) in
-  sprintf "%s %d" month year,
-  sprintf "%s %d %d %d:%02d:%02d" (String.sub month 0 3) now.Unix.tm_mday year
-    now.Unix.tm_hour now.Unix.tm_min now.Unix.tm_sec
-
-let short_date, full_date = get_date ()
+let short_date, full_date = get_date_debian ()

 (** * Command-line parsing *)
