that's because time() returns the time in seconds. Your computations are taking less than 1 second.
You'll need a higher precision timer, but the standard lib doesn't offer one.
You'll need to look at external libs, or you'll have to do something with the platform's API. If you're on Windows, you can #include <windows.h> and use GetTickCount(), which returns the time in milliseconds.
Get TickCount is the simplest, but even it might not be a high enough resolution.