Refactor main()
We remove the hack with the sleep and global "delay"-variable and use a monotonic clock to derive the desired monotonic properties of the tool. Inside each function that demands a personal delay we can then just do a nanosleep() and be done with it. It's a shame that timespec is so ugly to work with, but there's really no way to make it more beautiful. However, at this cost though we finally can set the interval times in milliseconds and not only just seconds. We remove setlocale(), because nothing good ever came out of this function. Besides that we have some more code refactoring, especially in the argument loop which saves us a bit of complexity.
This commit is contained in:

committed by
Aaron Marcher

parent
3468a6e368
commit
796b661284
@ -1,7 +1,7 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* how often to update the statusbar (min value == 1) */
|
||||
static const int update_interval = 1;
|
||||
/* interval between updates (in ms) */
|
||||
static const int interval = 1000;
|
||||
|
||||
/* text to show if no value can be retrieved */
|
||||
static const char unknown_str[] = "n/a";
|
||||
|
Reference in New Issue
Block a user