diff tests/millis.ur @ 1685:225b87d4a7df

Basis.toMilliseconds and diffInMilliseconds, based on a patch from Gergely Buday
author Adam Chlipala <adam@chlipala.net>
date Sat, 04 Feb 2012 11:01:06 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/millis.ur	Sat Feb 04 11:01:06 2012 -0500
@@ -0,0 +1,17 @@
+fun diffThem tm =
+    tm' <- now;
+    return <xml><body>
+      Diff: {[diffInMilliseconds tm tm']}
+    </body></xml>
+
+fun main () : transaction page =
+    tm <- now;
+
+    return <xml><body>
+      Now: {[toMilliseconds tm]}<br/>
+      <a link={diffThem tm}>Diff</a><br/>
+      
+      <button onclick={tm' <- now;
+                       alert ("Now: " ^ show (toMilliseconds tm'));
+                       alert ("Diff: " ^ show (diffInMilliseconds tm tm'))}/>
+    </body></xml>