Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!zaphod.mps.ohio-state.edu!ncar!gatech!bloom-beacon!dont-send-mail-to-path-lines From: jordan@tcs.COM (Jordan Hayes) Newsgroups: comp.windows.x Subject: Re: how can I put a digital clock in the title bar? Message-ID: <9104261804.AA10540@dwight.tcs.com> Date: 26 Apr 91 18:04:39 GMT References: <1991Apr25.010422.7232@porthos.cc.bellcore.com> Sender: daemon@athena.mit.edu (Mr Background) Organization: Teknekron Communications Systems, Inc., Berkeley, CA. Lines: 43 If you are using Xt, somewhere you will have made an applicationShell, and you could add the code below to your program. It "ticks" every second; if you didn't like that, change the 1000 to 10000 for every 10 seconds, or 60000 for once per minute and change the sprintf() call to use %16.16s instead ... ... extern XtAppContext app; static void _Tick(closure, id) XtPointer closure; XtIntervalId *id; { char *str, buf[40]; Widget shell; struct timeval tp; struct timezone tzp; shell = (Widget)closure; if (gettimeofday(&tp, &tzp) < 0) (void)strcpy(buf, "time = ?"); else { str = ctime(&tp.tv_sec); (void)sprintf(buf, "%19.19s", str); } XStoreName(XtDisplay(shell), XtWindow(shell), buf); XtAppAddTimeOut(app, 1000, _Tick, (XtPointer)shell); } ... Widget shell; shell = XtAppCreateShell(NULL, "Bart", applicationShellWidgetClass, display, NULL, 0); XtAppAddTimeOut(app, 1000, _Tick, (XtPointer)shell); ... /jordan