aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-02-04 11:01:06 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2012-02-04 11:01:06 -0500
commit09c2534e57944a9b5d6cc8971d0733d25749ade5 (patch)
treee85b1d872c1f40a0b7ba471cf80d0787e65c7eb7 /lib
parent36603eae600143253959ad94cdc5bb75a766b91c (diff)
Basis.toMilliseconds and diffInMilliseconds, based on a patch from Gergely Buday
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js8
-rw-r--r--lib/ur/basis.urs2
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index b557147b..a5ab90c5 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -132,10 +132,18 @@ function diffInSeconds(tm1, tm2) {
return Math.round((tm2 - tm1) / 1000000);
}
+function diffInMilliseconds(tm1, tm2) {
+ return Math.round((tm2 - tm1) / 1000);
+}
+
function toSeconds(tm) {
return Math.round(tm / 1000000);
}
+function toMilliseconds(tm) {
+ return Math.round(tm / 1000);
+}
+
function addSeconds(tm, n) {
return tm + n * 1000000;
}
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 3afb4985..67e6abc6 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -161,6 +161,8 @@ val addSeconds : time -> int -> time
val toSeconds : time -> int
val diffInSeconds : time -> time -> int
(* Earlier time first *)
+val toMilliseconds : time -> int
+val diffInMilliseconds : time -> time -> int
val timef : string -> time -> string (* Uses strftime() format string *)
val readUtc : string -> option time