aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2019-11-26 09:07:52 +0100
committerlns <matzeton@googlemail.com>2019-11-26 09:07:52 +0100
commit2dbc9b55f157497456d944076d2c6cf28cd1f5cf (patch)
treeaff56fdbe651c86b95351985e902aacfa8ee8355
parentbe09e1394c02339de8d253645302cd6df716e891 (diff)
added nsleep() simple nanosleep func
-rw-r--r--progressbar.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/progressbar.c b/progressbar.c
index db60143..904ec27 100644
--- a/progressbar.c
+++ b/progressbar.c
@@ -10,6 +10,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <time.h>
struct filtered_dir_entries {
@@ -302,6 +303,15 @@ static void show_progressbar(struct file_info * const finfo)
add_printable_buf(finfo, "[%s]", buf);
}
+static int nsleep(unsigned long long int nanosecs)
+{
+ struct timespec tim;
+ tim.tv_sec = 0;
+ tim.tv_nsec = nanosecs;
+
+ return nanosleep(&tim , NULL);
+}
+
int main(int argc, char **argv)
{
struct filtered_dir_entries proc_pid_entries = {};
@@ -392,7 +402,7 @@ int main(int argc, char **argv)
printf("%s", finfo.terminal.output);
fflush(stdout);
- sleep(1);
+ nsleep(150000000L);
}
puts("\n");