From 19a1e03f5d9876af3341372751969953f81f6ab5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 5 Dec 2000 03:22:35 +0000 Subject: [PATCH] apply Misty's clock patch part 2 --- source/gl_screen.c | 2 +- source/screen.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/source/gl_screen.c b/source/gl_screen.c index 94d6c38..9bcd892 100644 --- a/source/gl_screen.c +++ b/source/gl_screen.c @@ -491,7 +491,7 @@ void SCR_DrawTime (void) /* now actually print it to the screen directly below where show_fps is */ sprintf(st, "%s", local_time); x = vid.width - strlen(st) * 8 - 8; - y = vid.height - sb_lines - 0; + y = vid.height - sb_lines - 16; Draw_String8 (x, y, st); } diff --git a/source/screen.c b/source/screen.c index 12e5705..e6f0236 100644 --- a/source/screen.c +++ b/source/screen.c @@ -511,6 +511,30 @@ void SCR_DrawFPS (void) Draw_String8 (x, y, st); } +/* Misty: I like to see the time */ +void SCR_DrawTime (void) +{ + extern cvar_t *show_time; + int x, y; + char st[80]; + char local_time[120]; + time_t systime; + + if (!show_time->int_val) + 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)); + /* now actually print it to the screen directly below where show_fps is +*/ + sprintf(st, "%s", local_time); + x = vid.width - strlen(st) * 8 - 8; + y = vid.height - sb_lines - 16; + Draw_String8 (x, y, st); +} + /* ============== DrawPause @@ -1086,6 +1110,7 @@ void SCR_UpdateScreen (void) SCR_DrawTurtle (); SCR_DrawPause (); SCR_DrawFPS (); + SCR_DrawTime (); SCR_CheckDrawCenterString (); Sbar_Draw (); SCR_DrawConsole ();