summaryrefslogtreecommitdiff
path: root/src/c
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 /src/c
parent36603eae600143253959ad94cdc5bb75a766b91c (diff)
Basis.toMilliseconds and diffInMilliseconds, based on a patch from Gergely Buday
Diffstat (limited to 'src/c')
-rw-r--r--src/c/urweb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 738c765c..0b04f665 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -3681,6 +3681,14 @@ uw_Basis_int uw_Basis_diffInSeconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_
return difftime(tm2.seconds, tm1.seconds);
}
+uw_Basis_int uw_Basis_toMilliseconds(uw_context ctx, uw_Basis_time tm) {
+ return tm.seconds * 1000 + tm.microseconds / 1000;
+}
+
+uw_Basis_int uw_Basis_diffInMilliseconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) {
+ return uw_Basis_toMilliseconds(ctx, tm2) - uw_Basis_toMilliseconds(ctx, tm1);
+}
+
uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) {
return tm.seconds;
}