]> git.plutz.net Git - rigidfind/commitdiff
bugfix: time calculation master
authorPaul Hänsch <paul@plutz.net>
Wed, 13 Mar 2024 23:41:17 +0000 (00:41 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 13 Mar 2024 23:41:17 +0000 (00:41 +0100)
index.cgi

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