Any help would be appreciated, and also how could i do the same
without using threads?


This seems to work fine for me...

--- a/dwm.c     Thu Jul 03 17:05:56 2008 +0100
+++ b/dwm.c     Fri Jul 11 00:26:08 2008 -0700
@@ -1313,11 +1313,28 @@ setmfact(const Arg *arg) {
        arrange();
 }

+#include <time.h>
+
+void
+updatestatus(int signum) {
+    time_t t = time(0);
+    struct tm *ctm = localtime(&t);
+
+    strftime(stext, sizeof(stext), "%T", ctm);
+    drawbar();
+
+    signal(SIGALRM, updatestatus);
+    alarm(1);
+}
+
 void
 setup(void) {
        uint i;
        int w;
        XSetWindowAttributes wa;
+
+       signal(SIGALRM, updatestatus);
+       alarm(1);

        /* init screen */
        screen = DefaultScreen(dpy);


Reply via email to