diff --git a/C#/Program.cs b/C#/Program.cs index ba95418..a85886a 100644 --- a/C#/Program.cs +++ b/C#/Program.cs @@ -7,7 +7,7 @@ * February 8, 2013 * * Syntax: queens [-test] [N] - * + * ******************************************************************************/ using System; @@ -42,7 +42,7 @@ static void Main(string[] args) time = DateTime.Now.Ticks - time; if (testing) - Console.WriteLine(chess.Steps + "\t" + chess.Discards + "\t" + time / 10000); + Console.WriteLine(chess.Steps + "\t" + chess.Discards + "\t" + time / 10); else { Console.WriteLine(chess.ToString()); diff --git a/JS/queens.js b/JS/queens.js index 4710523..9f4de47 100644 --- a/JS/queens.js +++ b/JS/queens.js @@ -27,16 +27,16 @@ if (isNaN(n) || n < 4) { var chess = new libchess.Chess(n) var hrtime = process.hrtime() -var time = hrtime[0] + hrtime[1] / 1e9 +var time = hrtime[0] *1e6 + hrtime[1] / 1e3 chess.solve() hrtime = process.hrtime() -time = parseInt((hrtime[0] + hrtime[1] / 1e9 - time) * 1000) +time = parseInt((hrtime[0] *1e6 + hrtime[1] / 1e3 - time)) if (testing) console.log(String(chess.steps()) + "\t" + chess.discards() + "\t" + time) else { console.log(String(chess)) - console.log("Solved in " + chess.steps() + " steps. Time: " + time + " ms.") + console.log("Solved in " + chess.steps() + " steps. Time: " + time / 1000 + " ms.") } diff --git a/Java/queens/Main.java b/Java/queens/Main.java index 4c16303..335f69b 100644 --- a/Java/queens/Main.java +++ b/Java/queens/Main.java @@ -42,16 +42,16 @@ public static void main(String[] args) { } chess = new Chess(n); - time = System.currentTimeMillis(); + time = System.nanoTime(); chess.solve(); - time = System.currentTimeMillis() - time; + time = System.nanoTime() - time; if (testing) { - System.out.println(chess.getSteps() + "\t" + chess.getDiscards() + "\t" + time); + System.out.println(chess.getSteps() + "\t" + chess.getDiscards() + "\t" + time / 1000); } else { System.out.println(chess); System.out.print("Solved in " + chess.getSteps() + " steps. "); - System.out.println("Time: " + time + " ms."); + System.out.println("Time: " + time / 1000000 + " ms."); } } } diff --git a/PHP/queens.php b/PHP/queens.php index 676bc98..4c4a831 100644 --- a/PHP/queens.php +++ b/PHP/queens.php @@ -34,7 +34,7 @@ $chess = new Chess($n); $time = microtime(true); $chess->solve(); -$time = (int)((microtime(true) - $time) * 1000); +$time = (int)((microtime(true) - $time) * 1e6); $steps = $chess->steps(); $discards = $chess->discards(); @@ -42,5 +42,6 @@ echo "$steps\t$discards\t$time\n"; else { echo $chess; + $time /= 1000; echo "Solved in $steps steps. Time: $time ms.\n"; } diff --git a/Python/queens.py b/Python/queens.py index 3d5c1fa..b38943b 100755 --- a/Python/queens.py +++ b/Python/queens.py @@ -37,10 +37,10 @@ chess = Chess(n) time = perf_counter() chess.solve() - time = int((perf_counter() - time) * 1000) + time = int((perf_counter() - time) * 1e6) if testing: print(str(chess.steps()) + "\t" + str(chess.discards()) + "\t" + str(time)); else: print(chess) - print("Solved in", chess.steps(), "steps. Time:", time, "ms.") + print("Solved in", chess.steps(), "steps. Time:", time / 1000, "ms.")