From: Paul Hänsch <paul@plutz.net>
Date: Wed, 13 Mar 2024 23:41:17 +0000 (+0100)
Subject: bugfix: time calculation
X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=1e24339d733b07b22a2fe842d4cc848047466ddc;p=rigidfind

bugfix: time calculation
---

diff --git a/index.cgi b/index.cgi
index 94c3970..945d133 100755
--- a/index.cgi
+++ b/index.cgi
@@ -236,14 +236,14 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then
   )"
   results="${results%	}"
 
-  t="$(( ${_DATE}${_date_n} - $(date +%s%N) ))"
+  t="$(( $(date +%s%N) - ${_DATE}${_date_n} ))"
 
   cat <<-EOF
 	Status: 200 OK
 	X-elastic-product: Elasticsearch
 	Content-Type: application/vnd.elasticsearch+json;compatible-with=8
 	
-	{ "took":$((t / 1000)),
+	{ "took":$((t / 1000000)),
 	  "timed_out":false,
 	  "hits": {
 	    "total":{"value": $(DB2 "$results" count @) ,"relation":"eq"},