Mercurial > urweb
diff src/c/urweb.c @ 1685:225b87d4a7df
Basis.toMilliseconds and diffInMilliseconds, based on a patch from Gergely Buday
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 04 Feb 2012 11:01:06 -0500 |
parents | 3636d0eeb39c |
children | ae22d1fd9b80 |
line wrap: on
line diff
--- a/src/c/urweb.c Sat Feb 04 10:42:18 2012 -0500 +++ b/src/c/urweb.c Sat Feb 04 11:01:06 2012 -0500 @@ -3681,6 +3681,14 @@ 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; }