Darned clock watchers!
Brian K. White
brian at aljex.com
Thu Dec 11 16:53:33 PST 2008
----- Original Message -----
From: "Joe Chasan" <joe at magnatechonline.com>
To: "filePro" <filepro-list at lists.celestial.com>
Sent: Thursday, December 11, 2008 1:16 PM
Subject: Darned clock watchers!
>
> on Unix, in a terminal session, i need a way to constantly display system
> time (hms) on a screen.
>
> i can put it on screen and have a loop to display or video-sync either
> @entsel or @wef - problem is that while in middle of typing characters
> in a field, i can't force update.
>
> Background: timeclock application - users have to swipe a card or type
> some info to clock in/out - they watch until last second possible to get
> whatever maximum benefit is is for themselves - some of them type info into
> field and are waiting until clock strikes certain time before pressing
> <enter>
>
> i can't see it worth replacing all input fields on screen (even though
> there's only a few) with inkey or waitkey loops and concatenating to
> reassemble data back into fields, but maybe i'm overthinking this and
> missing some obvious method.
>
> i also note <DRAW> key code does not force update of time, i guess that's
> an fp design decision.
>
> FWIW, the server is syncronized to an NTP server on internet - most users
> are on PC's, but windows time syncronization is not as reliable so
> apparently just looking at windows clock wasn't doing it for them.
That is retarded.
Can you convince the employer to coarsen the resolution to whole minutes?
Then the users can walk up and puch in/out any time and it doesn't matter what second they do so. They either get paid for that whole minute, or they don't. There would no longer be any point to typing and then waiting to hit enter or escesc unles they do it whole minutes in advance, which seems like it might cause friction with other users needing to clock in/out.
However, you should be able to do this with inkey and a tight loop.
Something like this:
...
GOSUB inclk 'clock-input loop
log the user in/out according to UI
end or goto top or whatever
...
inclk:
sleep "100"
keystroke = inkey , UI = UI + keystroke
if keystroke or UI co magic submit/finish key or sequence, RETURN
if @tm eq TM, GOTO inclk
TM = @tm , display, GOTO inclk
UI is the acumulated user input in screen displayable dummy.
TM is the last known time, not displayed, put @tm on the screen.
Instead of the display command, which redraws the whole screen and may flicker the screen unaesthetically, maybe do 2 show statements to redraw just @tm and !UI
Result, hopefully: Ten times per second you check for keystrokes and to see if the time ticked over to a new second. Once per second you update the display, which includes !UI and @tm
Inkey does not block like waitkey or input or @update. Inkey just immediately collects a keystroke if one has been entered, or collects nothing, but either way it operates and finishes and processing proceeds to the next step instantly.
Completely off the cuff and untested.
--
Brian K. White brian at aljex.com http://www.myspace.com/KEYofR
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
More information about the Filepro-list
mailing list