How to map integer values and round to a count of tens/thousands? I'm mapping a potentiometer from 0-1023 to 1000-120000 (1 sec to 2 minutes) for a timer, like:

maxDelay = map (pot2, 0, 1023, 1000, 120000);


Both variables are integers. Now I would like to convert/round values to counts of 10 seconds (a count of thousands), so if I have anything from 1001-5000 this would be rounded to 1000 (1sec), and if I have 5001-10000 it would be rounded to 10000 (10 secs), then 20sec, 30sec, etc...until it reaches 120secs. I know I could have a few "if" statements but I'm trying to figure out the right way of doing these maths. Thanks.
I didn't yet compiled it, but something like this should work:

#include &lt;Math.h&gt;

int converter(int x)
{
    if(x &lt;= 5000)
        return 1000;
    else 
        return (int)(round(x / 10000.0) * 10000.0);
}