commit 0831cd859cb2a559a4fde5c8ded0b3c1b3811c2f parent 7eb8a64aa5e4a9badacef1c7beb4d52111d1577d Author: Antoni Sawicki <as@tenoware.com> Date: Tue, 23 Oct 2018 01:23:11 -0700 better handle counter rewinds Diffstat:
M | ttyplot.c | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/ttyplot.c b/ttyplot.c @@ -199,6 +199,9 @@ int main(int argc, char *argv[]) { values1[n]=(cval1-pval1)/td; + if(values1[n] < 0) // counter rewind + values1[n]=0; + if(two) { if(cval2==FLT_MAX) pval2=values2[n]; @@ -207,6 +210,9 @@ int main(int argc, char *argv[]) { cval2=values2[n]; values2[n]=(cval2-pval2)/td; + + if(values2[n] < 0) // counter rewind + values2[n]=0; } }