summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-04-13 09:24:05 +0000
committersabetts <sabetts>2001-04-13 09:24:05 +0000
commit58214c0d8b72ade928ce491da191af70d789e83b (patch)
tree883ad7ba0132e069624292e9b0c3b7f85be55213 /src/actions.c
parentbb36a84d39dc9d189e67874fff38c38a9812387a (diff)
downloadratpoison-58214c0d8b72ade928ce491da191af70d789e83b.zip
* src/actions.c (cmd_clock): doesn't allocate memory. displays the
date.
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c18
1 files changed, 6 insertions, 12 deletions
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));
}