summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/actions.c18
2 files changed, 9 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 830f781..f11be06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2001-04-13 shawn <sabetts@diggin.lamenet.tmp>
+ * src/actions.c (cmd_clock): doesn't allocate memory. displays the
+ date.
+
* src/split.h (blank_frame): new prototype
* src/split.c (split_frame): calls unhide_window after maximizing
diff --git a/src/actions.c b/src/actions.c
index 097991b..e77f632 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -699,29 +699,23 @@ cmd_newwm(void *data)
/* exit (EXIT_SUCCESS); */
/* } */
-/* Show the current time on the bar. Thanks to
- Martin Samuelsson <cosis@lysator.liu.se> for the patch. */
+/* Show the current time on the bar. Thanks to Martin Samuelsson
+ <cosis@lysator.liu.se> for the patch. Thanks to Jonathan Walther
+ <djw@lineo.com> for making it pretty. */
void
cmd_clock (void *data)
{
- char *msg;
time_t timep;
- msg = xmalloc (9);
-
timep = time(NULL);
if(timep == ((time_t)-1))
{
- perror("In show_clock() ");
+ PRINT_ERROR ("time() failed\n")
return;
}
-
- strncpy(msg, ctime(&timep) + 11, 8); /* FIXME: a little bit hardcoded looking */
- msg[8] = '\0';
-
- message (msg);
- free(msg);
+ /* FIXME: There's an annoying newline at the end */
+ message (ctime(&timep));
}