comparison 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
comparison
equal deleted inserted replaced
1595:154cfe2eb366 1597:e283ca05c829
132 return Math.round(tm / 1000000); 132 return Math.round(tm / 1000000);
133 } 133 }
134 134
135 function addSeconds(tm, n) { 135 function addSeconds(tm, n) {
136 return tm + n * 1000000; 136 return tm + n * 1000000;
137 }
138
139 function stringToTime(string){
140 return Date.parse(string) // returns milliseconds and we need microseconds
141 * 1000;
137 } 142 }
138 143
139 144
140 // Error handling 145 // Error handling
141 146
498 } 503 }
499 504
500 var tbody = document.createElement("tbody"); 505 var tbody = document.createElement("tbody");
501 for (script = table.firstChild; script; script = next) { 506 for (script = table.firstChild; script; script = next) {
502 next = script.nextSibling; 507 next = script.nextSibling;
503 508
504 tbody.insertBefore(script, tbody.firstChild); 509 tbody.insertBefore(script, tbody.firstChild);
505 } 510 }
506 table.appendChild(tbody); 511 table.appendChild(tbody);
507 } 512 }
508 513
1351 break; 1356 break;
1352 case "K": 1357 case "K":
1353 { var savedStack = stack.next, savedEnv = env; 1358 { var savedStack = stack.next, savedEnv = env;
1354 e = {c: "c", v: function(v) { return exec1(savedEnv, savedStack, {c: "c", v: v}); } };} 1359 e = {c: "c", v: function(v) { return exec1(savedEnv, savedStack, {c: "c", v: v}); } };}
1355 usedK = true; 1360 usedK = true;
1356 break; 1361 break;
1357 default: 1362 default:
1358 whine("Unknown Ur expression kind " + e.c); 1363 whine("Unknown Ur expression kind " + e.c);
1359 } 1364 }
1360 } 1365 }
1361 } 1366 }
1413 1418
1414 function fresh() { 1419 function fresh() {
1415 return (--nextId).toString(); 1420 return (--nextId).toString();
1416 } 1421 }
1417 1422
1423
1418 // App-specific code 1424 // App-specific code
1419