Simple C question, how can I correctly and succintly convert milliseconds to seconds.
There are two constraints:
- I’ve no floating point support in this tiny subset-of-C compiler
-
I need the seconds rounded to the nearest second(1-499ms rounds down,500-999ms rounds up. Don’t need to care about negative values)
int mseconds = 1600; // should be converted to 2 seconds int msec = 23487; // should be converted to 23 seconds
This should work