From cbf7cd54479c921dadb57bd1a8555077afe6f5fe Mon Sep 17 00:00:00 2001
From: Bill Currie <bill@taniwha.org>
Date: Tue, 5 Dec 2000 06:57:44 +0000
Subject: [PATCH] show_time 2 will select 12h clock as opposed to 24h (Misty
 again)

---
 source/gl_screen.c | 18 ++++++++++++++----
 source/screen.c    | 18 ++++++++++++++----
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/source/gl_screen.c b/source/gl_screen.c
index a92e01d..ff9af5b 100644
--- a/source/gl_screen.c
+++ b/source/gl_screen.c
@@ -493,15 +493,25 @@ void SCR_DrawTime (void)
 	char local_time[120];
 	time_t systime;
 	
-	if (!show_time->int_val)
+	/* any cvar that can take multiple settings must be able to handle abuse. */
+	if (show_time->int_val <= 0)
 		return;
 	
 	/* actually find the time and set systime to it*/
 	time(&systime);
-	/* now set local_time to 24 hour time using hours:minutes format */
-	strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime));
+	
+	if (show_time->int_val == 1) {
+		/* now set local_time to 24 hour time using hours:minutes format */
+		strftime (local_time, sizeof (local_time), "%k:%M",
+				  localtime (&systime));
+	} else if (show_time->int_val >= 2) {
+		/* >= is another abuse protector */
+		strftime (local_time, sizeof (local_time), "%l:%M %P",
+				  localtime(&systime));
+	}
+			
 	/* now actually print it to the screen directly below where show_fps is */
-	sprintf(st, "%s", local_time);
+	sprintf (st, "%s", local_time);
 	x = cl_hudswap->int_val ? vid.width - ((strlen (st) * 8) + 8) : 8;
 	y = vid.height - sb_lines - 16;
 	Draw_String8 (x, y, st);
diff --git a/source/screen.c b/source/screen.c
index 78b43e1..fa4fc87 100644
--- a/source/screen.c
+++ b/source/screen.c
@@ -526,15 +526,25 @@ void SCR_DrawTime (void)
 	char local_time[120];
 	time_t systime;
 	
-	if (!show_time->int_val)
+	/* any cvar that can take multiple settings must be able to handle abuse. */
+	if (show_time->int_val <= 0)
 		return;
 	
 	/* actually find the time and set systime to it*/
 	time(&systime);
-	/* now set local_time to 24 hour time using hours:minutes format */
-	strftime(local_time, sizeof(local_time), "%k:%M", localtime(&systime));
+	
+	if (show_time->int_val == 1) {
+		/* now set local_time to 24 hour time using hours:minutes format */
+		strftime (local_time, sizeof (local_time), "%k:%M",
+				  localtime (&systime));
+	} else if (show_time->int_val >= 2) {
+		/* >= is another cvar abuse protector */
+		strftime (local_time, sizeof (local_time), "%l:%M %P",
+				  localtime (&systime));
+	}
+			
 	/* now actually print it to the screen directly below where show_fps is */
-	sprintf(st, "%s", local_time);
+	sprintf (st, "%s", local_time);
 	x = cl_hudswap->int_val ? vid.width - ((strlen (st) * 8) + 8) : 8;
 	y = vid.height - sb_lines - 16;
 	Draw_String8 (x, y, st);