summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-07-22 15:39:38 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-07-22 15:39:38 -0400
commit383fa383fa5bf010b89d17bb61a84f675fb16fb6 (patch)
tree6656ba1a78bd4eb71c381dc95d2e7b1a8ce6b130 /lib
parent1ac8b4fcb81e8cc8d78d4542a2bc06190499a0cd (diff)
Backpedal on tutorial-motivated urweb-mode changes; add Basis.diffInSeconds and Basis.toSeconds
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js8
-rw-r--r--lib/ur/basis.urs3
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 76ad76fa..9834fde6 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -105,6 +105,14 @@ function now() {
return (new Date()).getTime() * 1000;
}
+function diffInSeconds(tm1, tm2) {
+ return Math.round((tm2 - tm1) / 1000000);
+}
+
+function toSeconds(tm) {
+ return Math.round(tm / 1000000);
+}
+
// Error handling
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index b60610cd..cabac068 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -145,6 +145,9 @@ val current : t ::: Type -> signal t -> transaction t
val now : transaction time
val minTime : time
val addSeconds : time -> int -> time
+val toSeconds : time -> int
+val diffInSeconds : time -> time -> int
+(* Earlier time first *)
val timef : string -> time -> string (* Uses strftime() format string *)
val readUtc : string -> option time