I want to create a timer to run on an embedded system with as little impact as possible. I can choose to implement the timer in C, C++, bash or python. The error in the timer can be +/- a few seconds.
I’m tempted just to create a loop in a bash script using the ‘sleep()’ command and the ‘&’ to start it in the background. However I’m worried/don’t quite understand if this will be keeping the system active/awake if implemented this way.
If it is keeping the system active/awake, is it possible to create a timer that doesn’t do that using C, C++, python or maybe another way with a bash script?
If you are worried about system resource or power consumption issue in an embedded system, you should definitely use RTC to implement timer.
Please refer to http://linux.die.net/man/4/rtc
And, check the user manual of the operating system you are using. Maybe there are some functions existing to call.
It is not necessary to reinvent the timer related functions.