Fix System.nanoTime definition (#3543)

While redesigning builtins a bug was accidentally introduced.
Stumbled upon accidentally while trying to run `test/Benchmarks`.
This commit is contained in:
Hubert Plociniczak 2022-06-24 12:46:31 +02:00 committed by GitHub
parent 972b34d1a9
commit 8f9a0b33d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -32,8 +32,8 @@ public class System {
@Builtin.Method(description = "Gets the nanosecond resolution system time.")
@CompilerDirectives.TruffleBoundary
public static void nanoTime() {
java.lang.System.nanoTime();
public static long nanoTime() {
return java.lang.System.nanoTime();
}
@Builtin.Method(description = "Exits the process, returning the provided code.")

View File

@ -59,6 +59,7 @@ import project.Runtime.Lazy_Generator_Spec
import project.System.File_Spec
import project.System.Process_Spec
import project.System.Reporting_Stream_Decoder_Spec
import project.System.System_Spec
main = Test.Suite.run_main <|
Any_Spec.spec
@ -112,3 +113,4 @@ main = Test.Suite.run_main <|
Vector_Spec.spec
Statistics_Spec.spec
Warnings_Spec.spec
System_Spec.spec

View File

@ -0,0 +1,9 @@
from Standard.Base import all
import Standard.Base.System
import Standard.Test
spec = Test.group "System" <|
Test.specify "should provide nanosecond timer" <|
result = System.nano_time
(result > 0).should_equal True