sleep only if needed
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 22 May 2017 19:03:02 +0000 (21:03 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 22 May 2017 19:03:02 +0000 (21:03 +0200)
gnt-monitor

index 079948d..3a1973f 100755 (executable)
@@ -190,6 +190,6 @@ if ( system( 'curl', '-XPOST', $INFLUX, '--data-binary', '@/dev/shm/gnt-monitor.
 }
 
 my $dt = time() - $begin_t;
-sleep $INTERVAL - $dt if $dt > $INTERVAL;
+sleep $INTERVAL - $dt if $dt > 0 && $dt > $INTERVAL;
 } #/while