Mercurial > urweb
comparison src/c/urweb.c @ 2187:14c45a0b6362
Basis.fromMilliseconds
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 01 Nov 2015 11:55:01 -0500 |
parents | d87d72b6e299 |
children | 985c8016b592 |
comparison
equal
deleted
inserted
replaced
2186:d87d72b6e299 | 2187:14c45a0b6362 |
---|---|
4058 | 4058 |
4059 uw_Basis_int uw_Basis_toMilliseconds(uw_context ctx, uw_Basis_time tm) { | 4059 uw_Basis_int uw_Basis_toMilliseconds(uw_context ctx, uw_Basis_time tm) { |
4060 return tm.seconds * 1000 + tm.microseconds / 1000; | 4060 return tm.seconds * 1000 + tm.microseconds / 1000; |
4061 } | 4061 } |
4062 | 4062 |
4063 uw_Basis_time uw_Basis_fromMilliseconds(uw_context ctx, uw_Basis_int n) { | |
4064 uw_Basis_time tm = {n / 1000, n % 1000 * 1000}; | |
4065 return tm; | |
4066 } | |
4067 | |
4063 uw_Basis_int uw_Basis_diffInMilliseconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) { | 4068 uw_Basis_int uw_Basis_diffInMilliseconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) { |
4064 return uw_Basis_toMilliseconds(ctx, tm2) - uw_Basis_toMilliseconds(ctx, tm1); | 4069 return uw_Basis_toMilliseconds(ctx, tm2) - uw_Basis_toMilliseconds(ctx, tm1); |
4065 } | 4070 } |
4066 | 4071 |
4067 uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) { | 4072 uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) { |