How to make a free running counter resetable by pressing a key.
Linux kernel 2.16
Hi: Let clk be the counter. clk is always counting but, when I press a keyboard key it resets itself and starts over from zero. I go to make a coffee and, when coming back and begin typing again, if I also have variable clk_old, I can know how much time I spent in the kitchen. Ok. The program is almost done but: 1) Can this be done by a script? If so, I'd need the whole script. I not: 2) Is there a signal that interrupts every, say 1s? 3) Please consider I'm new both to linux and to C. In another environment, this would seem a pretty simple program for me to write. The only concern, I think, is how to catch the signal and write the handler (only the body). Thanks for reading. |
This sounds like homework
|
I forgot. Compiler: gcc (GCC) 4.1.2.
|
Beleave me. I'm not. I program since a youngster. Thanks for
reading. |
It's possible to do with a script, likely with awk:
http://www.grymoire.com/Unix/Awk.html#uh-50 |
Thanks a lot. It's first thing I want do with linux, learning scripts, since I've seen i go nowhere without understanding them. There's also the other alternative. Isolate one self in the language, and all between the compiler and os. Thanks again.
|
All times are GMT -5. The time now is 04:35 AM. |