[m-rev.] for review: Uncomment foreign code definition for clock/3.

Paul Bone paul at bone.id.au
Tue May 24 17:11:10 AEST 2016


While I was working on temprary files I thought I needed this to help
generate random filenames, but time/3 is better.  Anyway I seem to have this
working on Mono, but cannot test .NET.

For review by Sebastian Godelet.

I was working on something else and thought I needed to use clock/3 from
time.m, so I tried to get it working

It seems to be working but I cannot test it on .NET. 

---
Uncomment foreign code definition for clock/3.

I noticed this code commented out in time.m, I guessed it'd be
straightforward to make work and it seems to be working on mono.  I cannot
test it on .NET though.

library/time.m:
    As above.
---
 library/time.m | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/library/time.m b/library/time.m
index bf4caad..ea9c569 100644
--- a/library/time.m
+++ b/library/time.m
@@ -264,16 +264,14 @@ time.clock(Result, !IO) :-
 "
     Ret = (MR_Integer) clock();
 ").
-/* XXX need to add System.dll to the references list.
 :- pragma foreign_proc("C#",
     time.c_clock(Ret::out, _IO0::di, _IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io],
 "{
     // XXX Ticks is long in .NET!
-    Ret = (int) System.Diagnostics.Process.GetCurrentProcess
-        .UserProcessorTime.Ticks;
+    Ret = (int) System.Diagnostics.Process.GetCurrentProcess().
+        UserProcessorTime.Ticks;
 }").
-*/
 :- pragma foreign_proc("Java",
     time.c_clock(Ret::out, _IO0::di, _IO::uo),
     [will_not_call_mercury, promise_pure, tabled_for_io],
-- 
2.8.1



More information about the reviews mailing list