diff lib/js/urweb.js @ 1597:e283ca05c829

Add read instance for time on the client
author Ron de Bruijn <rmbruijn@gmail.com>
date Thu, 17 Nov 2011 17:14:44 +0100
parents f403e129c276
children 252e05bf199d
line wrap: on
line diff
--- a/lib/js/urweb.js	Mon Nov 14 09:15:10 2011 -0500
+++ b/lib/js/urweb.js	Thu Nov 17 17:14:44 2011 +0100
@@ -136,6 +136,11 @@
     return tm + n * 1000000;
 }
 
+function stringToTime(string){
+   return  Date.parse(string)  // returns milliseconds and we need microseconds
+                      * 1000;
+}
+
 
 // Error handling
 
@@ -500,7 +505,7 @@
     var tbody = document.createElement("tbody");
     for (script = table.firstChild; script; script = next) {
         next = script.nextSibling;
-        
+
         tbody.insertBefore(script, tbody.firstChild);
     }
     table.appendChild(tbody);
@@ -1353,7 +1358,7 @@
             { var savedStack = stack.next, savedEnv = env;
                 e = {c: "c", v: function(v) { return exec1(savedEnv, savedStack, {c: "c", v: v}); } };}
             usedK = true;
-            break;      
+            break;
         default:
             whine("Unknown Ur expression kind " + e.c);
         }
@@ -1415,5 +1420,5 @@
     return (--nextId).toString();
 }
 
+
 // App-specific code
-