diff --git a/gfx.cpp b/gfx.cpp
index 548843e8..5e4a1636 100644
--- a/gfx.cpp
+++ b/gfx.cpp
@@ -26,6 +26,7 @@ void (*S9xCustomDisplayString) (const char *, int, int, bool, int) = NULL;
static void SetupOBJ (void);
static void DrawOBJS (int);
+static void DisplayTime (void);
static void DisplayFrameRate (void);
static void DisplayPressedKeys (void);
static void DisplayWatchedAddresses (void);
@@ -1838,6 +1839,20 @@ static void S9xDisplayStringType (const char *string, int linesFromBottom, int p
S9xDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap);
}
+static void DisplayTime (void)
+{
+ char string[10];
+
+ time_t rawtime;
+ struct tm *timeinfo;
+
+ time (&rawtime);
+ timeinfo = localtime(&rawtime);
+
+ sprintf(string, "%02u:%02u", timeinfo->tm_hour, timeinfo->tm_min);
+ S9xDisplayString(string, 0, 0, false);
+}
+
static void DisplayFrameRate (void)
{
char string[10];
@@ -2031,6 +2046,9 @@ static void DisplayWatchedAddresses (void)
void S9xDisplayMessages (uint16 *screen, int ppl, int width, int height, int scale)
{
+ if (Settings.DisplayTime)
+ DisplayTime();
+
if (Settings.DisplayFrameRate)
DisplayFrameRate();
diff --git a/gtk/src/gtk_config.cpp b/gtk/src/gtk_config.cpp
index 90f8f5b8..20c943f7 100644
--- a/gtk/src/gtk_config.cpp
+++ b/gtk/src/gtk_config.cpp
@@ -165,6 +165,7 @@ int Snes9xConfig::load_defaults ()
Settings.AutoSaveDelay = 0;
Settings.SkipFrames = 0;
Settings.Transparency = true;
+ Settings.DisplayTime = false;
Settings.DisplayFrameRate = false;
Settings.SixteenBitSound = true;
Settings.Stereo = true;
@@ -341,6 +342,7 @@ int Snes9xConfig::save_config_file ()
#undef z
#define z "Emulation::"
outbool (cf, z"EmulateTransparency", Settings.Transparency);
+ outbool (cf, z"DisplayTime", Settings.DisplayTime);
outbool (cf, z"DisplayFrameRate", Settings.DisplayFrameRate);
outbool (cf, z"DisplayPressedKeys", Settings.DisplayPressedKeys);
cf.SetInt (z"SpeedControlMethod", Settings.SkipFrames, "0: Time the frames to 50 or 60Hz, 1: Same, but skip frames if too slow, 2: Synchronize to the sound buffer, 3: Unlimited, except potentially by vsync");
@@ -570,6 +572,7 @@ int Snes9xConfig::load_config_file ()
#undef z
#define z "Emulation::"
inbool (z"EmulateTransparency", Settings.Transparency);
+ inbool (z"DisplayTime", Settings.DisplayTime);
inbool (z"DisplayFrameRate", Settings.DisplayFrameRate);
inbool (z"DisplayPressedKeys", Settings.DisplayPressedKeys);
inint (z"SpeedControlMethod", Settings.SkipFrames);
diff --git a/gtk/src/gtk_preferences.cpp b/gtk/src/gtk_preferences.cpp
index 54f9aa0e..30565c74 100644
--- a/gtk/src/gtk_preferences.cpp
+++ b/gtk/src/gtk_preferences.cpp
@@ -607,6 +607,7 @@ void
Snes9xPreferences::move_settings_to_dialog ()
{
set_check ("full_screen_on_open", config->full_screen_on_open);
+ set_check ("show_time", Settings.DisplayTime);
set_check ("show_frame_rate", Settings.DisplayFrameRate);
set_check ("show_pressed_keys", Settings.DisplayPressedKeys);
set_check ("change_display_resolution", config->change_display_resolution);
@@ -823,6 +824,7 @@ Snes9xPreferences::get_settings_from_dialog ()
#endif
config->full_screen_on_open = get_check ("full_screen_on_open");
+ Settings.DisplayTime = get_check ("show_time");
Settings.DisplayFrameRate = get_check ("show_frame_rate");
Settings.DisplayPressedKeys = get_check ("show_pressed_keys");
config->scale_to_fit = get_check ("scale_to_fit");
diff --git a/gtk/src/snes9x.ui b/gtk/src/snes9x.ui
index 4c1c9efb..a9281f17 100644
--- a/gtk/src/snes9x.ui
+++ b/gtk/src/snes9x.ui
@@ -2761,6 +2761,21 @@
0
+
+
+
+ False
+ False
+ 1
+
+