I'm writing a random number generator program and using time() to seed
it. I found out that time() output is in seconds. Do you know of
another function that outputs in thousands of seconds ? Thanx.
First, you found out that your implementation of the C standard time()
function outputs in seconds. There is no guarantee this is true for all
implementations.
Second, there is no function guaranteed to output thousands of seconds.
There is a clock() function. It will return 1/CLOCKS_PER_SEC.
Additionally, this function will return the implementation's best
approximation to the processor time used. If the clock on your machine is
only accurate to a certain degree you might find this is off by a few
milliseconds.
Third, the clock() function is the number of 'ticks' since a predefined
time period. That time period could be a fixed date (just like time()
does) or it could be the start of program execution. If you have no user
input and no external events that change the run time of your application,
the clock() function could return the same value. Even worse, if there is
no support for clock() it will always return (clock_t)-1.
Finally, you never stated WHY you need something with better granularity
than the time() function. I cannot give you a function that is guaranteed
to return a value in thousands of seconds and without knowing why you need
that I cannot suggest an alternative.