Hi

I had this patch locally for couple of weeks just having the proper current
year reliably for the verbosity information part, relying on the startup
date.

Kind regards.
From deab708b01f90a14e466dcca29056b007eddd600 Mon Sep 17 00:00:00 2001
From: David Carlier <devne...@gmail.com>
Date: Fri, 26 Jan 2018 17:24:30 +0000
Subject: [PATCH] BUILD/MINOR: haproxy

Displaying dynamically the current year, rather using start date
over HAPROXY_DATE data to be sure.
---
 src/haproxy.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/haproxy.c b/src/haproxy.c
index 98b18daf..e2936680 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -123,6 +123,9 @@ static struct list cfg_cfgfiles = LIST_HEAD_INIT(cfg_cfgfiles);
 int  pid;			/* current process id */
 int  relative_pid = 1;		/* process id starting at 1 */
 unsigned long pid_bit = 1;      /* bit corresponding to the process id */
+struct tm current_date;
+char current_year[5];
+const char *current_author = "Willy Tarreau <wi...@haproxy.org>";
 
 /* global options */
 struct global global = {
@@ -354,7 +357,7 @@ void hap_register_per_thread_deinit(void (*fct)())
 static void display_version()
 {
 	printf("HA-Proxy version " HAPROXY_VERSION " " HAPROXY_DATE"\n");
-	printf("Copyright 2000-2017 Willy Tarreau <wi...@haproxy.org>\n\n");
+	printf("Copyright 2000-%s %s\n\n", current_year, current_author);
 }
 
 static void display_build_opts()
@@ -1309,6 +1312,8 @@ static void init(int argc, char **argv)
 	tzset();
 	tv_update_date(-1,-1);
 	start_date = now;
+	get_localtime(start_date.tv_sec, &current_date);
+	sprintf(current_year, "%d", 1900 + current_date.tm_year);
 
 	srandom(now_ms - getpid());
 
-- 
2.16.1

Reply via email to