From a03c7039eb703e86010c7c8bd2e462c01d4db7b7 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 14 Dec 2018 11:42:14 +0100 Subject: sfeed_tail: wakeup less often by default The files are now checked every 10 seconds instead of 1 second. NOTE: ofcourse it still first checks the filesize and modification time and only then proceeds. --- sfeed_tail.1 | 4 ++-- sfeed_tail.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sfeed_tail.1 b/sfeed_tail.1 index 9734339..955c423 100644 --- a/sfeed_tail.1 +++ b/sfeed_tail.1 @@ -1,4 +1,4 @@ -.Dd August 22, 2018 +.Dd December 14, 2018 .Dt SFEED_TAIL 1 .Os .Sh NAME @@ -28,7 +28,7 @@ will also only process and show items that are considered new: the item timestamp is not older than a day ago. .Sh IMPLEMENTATION NOTES .Nm -checks for file modifications each second by checking the filesize and +checks for file modifications every 10 seconds by checking the filesize and modification time. Keep in mind that because .Nm diff --git a/sfeed_tail.c b/sfeed_tail.c index cce8ea0..fd47a43 100644 --- a/sfeed_tail.c +++ b/sfeed_tail.c @@ -158,7 +158,7 @@ main(int argc, char *argv[]) continue; } - /* did the file change? by size, modification */ + /* did the file change? by size or modification time */ if (stfiles[i - 1].st_size != st.st_size || stfiles[i - 1].st_mtime != st.st_mtime) { name = ((name = strrchr(argv[i], '/'))) ? name + 1 : argv[i]; @@ -177,8 +177,8 @@ main(int argc, char *argv[]) changed = 0; slept = 0; } - sleep(1); - slept++; + sleep(10); + slept += 10; firsttime = 0; } return 0; -- cgit v1.2.3