fsharp: add time-ms to core.
authorJoel Martin <github@martintribe.org>
Sat, 24 Oct 2015 20:53:41 +0000 (15:53 -0500)
committerJoel Martin <github@martintribe.org>
Sat, 24 Oct 2015 20:53:41 +0000 (15:53 -0500)
fsharp/core.fs
fsharp/env.fs

index 9e22b20..2172cc0 100644 (file)
@@ -1,5 +1,6 @@
 module Core
     
+    open System
     open Types
 
     let inline toBool b = if b then Node.TRUE else Node.FALSE
@@ -23,6 +24,9 @@ module Core
     let gt = twoNodeOp (fun a b -> a > b |> toBool)
     let eq = twoNodeOp (fun a b -> a = b |> toBool)
 
+    let time_ms _ =
+        DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond |> int64 |> Number
+
     let list = Node.makeList
     let isList = function
         | [List(_, _)] -> Node.TRUE
index 5ae039a..1f0d45d 100644 (file)
@@ -56,6 +56,7 @@ module Env
               wrap "<=" Core.le
               wrap ">=" Core.ge
               wrap ">" Core.gt
+              wrap "time-ms" Core.time_ms
               wrap "pr-str" Core.pr_str
               wrap "str" Core.str
               wrap "prn" Core.prn