Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
1684:9dd8d47c3e58 | 1685:225b87d4a7df |
---|---|
3679 | 3679 |
3680 uw_Basis_int uw_Basis_diffInSeconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) { | 3680 uw_Basis_int uw_Basis_diffInSeconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) { |
3681 return difftime(tm2.seconds, tm1.seconds); | 3681 return difftime(tm2.seconds, tm1.seconds); |
3682 } | 3682 } |
3683 | 3683 |
3684 uw_Basis_int uw_Basis_toMilliseconds(uw_context ctx, uw_Basis_time tm) { | |
3685 return tm.seconds * 1000 + tm.microseconds / 1000; | |
3686 } | |
3687 | |
3688 uw_Basis_int uw_Basis_diffInMilliseconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) { | |
3689 return uw_Basis_toMilliseconds(ctx, tm2) - uw_Basis_toMilliseconds(ctx, tm1); | |
3690 } | |
3691 | |
3684 uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) { | 3692 uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) { |
3685 return tm.seconds; | 3693 return tm.seconds; |
3686 } | 3694 } |
3687 | 3695 |
3688 void *uw_get_global(uw_context ctx, char *name) { | 3696 void *uw_get_global(uw_context ctx, char *name) { |