[comp.unix.programmer] Timer

wongm@latcs1.oz.au (Mun C Wong) (03/07/91)

Does anybody know how to write a proper background timer program that
displays the current time on the upper-right corner of screen like
exists in DOS ? I tried it out but after upating the time , the cursor
doesn't return to where it should be . Is there a way to solve this
problem ? Note that I didn't implement the second-by-second updating
method but pass a command line argument integer so as this amount if
time elapses , only should the new time be written . I wonder is there
an efficient way of doing every-second updating while it doesn't
draws too much iritation to the foreground work ?

- wong

tchrist@convex.COM (Tom Christiansen) (03/08/91)

From the keyboard of wongm@latcs1.oz.au (Mun C Wong):
:Does anybody know how to write a proper background timer program that
:displays the current time on the upper-right corner of screen like
:exists in DOS ? 

How about lower corner?  Use sysline.

--tom

peter@doe.utoronto.ca (Peter Mielke) (03/12/91)

In <1991Mar08.132532.24494@convex.com>, Tom Christiansen writes:
> From the keyboard of wongm@latcs1.oz.au (Mun C Wong):
> :Does anybody know how to write a proper background timer program that
> :displays the current time on the upper-right corner of screen like
> :exists in DOS ? 
> 
> How about lower corner?  Use sysline.

Why restrict him to the lower corner, one can also place it in the
upper corner as well (just change the terminal description entry).
-- 
Peter Mielke                                    peter@doe.utoronto.ca
Dictionary of Old English Project               utgpu!utzoo!utdoe!peter
University of Toronto

mvadh@cbnews.att.com (andrew.d.hay) (03/14/91)

In article <1991Mar11.173124.3910@doe.utoronto.ca> peter@doe.utoronto.ca (Peter Mielke) writes:
"
"In <1991Mar08.132532.24494@convex.com>, Tom Christiansen writes:
"> From the keyboard of wongm@latcs1.oz.au (Mun C Wong):
"> :Does anybody know how to write a proper background timer program that
"> :displays the current time on the upper-right corner of screen like
"> :exists in DOS ? 
"> 
"> How about lower corner?  Use sysline.
"
"Why restrict him to the lower corner, one can also place it in the
"upper corner as well (just change the terminal description entry).

why cut the screen down when you already have a ststus line?

my first real (!"hello world") program was a clock; it used curses to
go to the status line, read the current time, printed it, then slept
for a settable interval.  after tuning it, i got it down to *1*
cpu-second per 8-hour day, updating every 15 seconds!

-- 
Andrew Hay		+------------------------------------------------------+
Ragged Individualist	| 			JAAAAAAANE!		       |
AT&T-BL Ward Hill MA	|	    HOW DO YOU STOP THIS CRAZY THING?	       |
a.d.hay@att.com		+------------------------------------------------------+

karish@mindcraft.com (Chuck Karish) (03/15/91)

In article <1991Mar14.115254.7998@cbnews.att.com> mvadh@cbnews.att.com
(andrew.d.hay) writes:
>In article <1991Mar11.173124.3910@doe.utoronto.ca> peter@doe.utoronto.ca
>(Peter Mielke) writes:
>
>"In <1991Mar08.132532.24494@convex.com>, Tom Christiansen writes:
>"> From the keyboard of wongm@latcs1.oz.au (Mun C Wong):
>"> :Does anybody know how to write a proper background timer program that
>"> :displays the current time on the upper-right corner of screen like
>"> :exists in DOS ? 
>"> 
>"> How about lower corner?  Use sysline.
>"
>"Why restrict him to the lower corner, one can also place it in the
>"upper corner as well (just change the terminal description entry).

In general, this doesn't work.  Unless sysline is using hardware status
line capabilities, the data it prints out scrolls with the rest of the
text on the screen.  Users of terminals without status line capability
would have to use an emulator program (perhaps based on curses) to
manage all screen output.

>why cut the screen down when you already have a ststus line?

sysline is designed to use the status line.

>my first real (!"hello world") program was a clock; it used curses to
>go to the status line, read the current time, printed it, then slept
>for a settable interval.  after tuning it, i got it down to *1*
>cpu-second per 8-hour day, updating every 15 seconds!

Congratulations.  You re-invented a small part of the sysline
program.

	Chuck Karish		karish@mindcraft.com
	Mindcraft, Inc.		(415) 323-9000

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (03/18/91)

In article <668979251.11500@mindcraft.com> karish@mindcraft.com (Chuck Karish) writes:
> Unless sysline is using hardware status
> line capabilities, the data it prints out scrolls with the rest of the
> text on the screen.  Users of terminals without status line capability
> would have to use an emulator program (perhaps based on curses) to
> manage all screen output.

But VT-compatible terminals (perhaps the majority of terminals in use)
can just change their scrolling region with ^[[1;24r (for example).

> >my first real (!"hello world") program was a clock; it used curses to
> >go to the status line, read the current time, printed it, then slept
> >for a settable interval.  after tuning it, i got it down to *1*
> >cpu-second per 8-hour day, updating every 15 seconds!
> Congratulations.  You re-invented a small part of the sysline
> program.

Nothing wrong with that. Many vendors ship (or, at least, used to ship)
versions of sysline that would completely misinterpret termcap delay
sequences, and sysline isn't particularly fast or careful about output
flushing or extensible or configurable, but even if it were perfect
there wouldn't be anything wrong with people cloning it to learn about
UNIX.

---Dan