Originally Posted by Ancient Dragon
also, your program can execute the same lines quite a few times during ther same second, so if time() is called twice during the same second it will return the same time. you have to insert a delay(), sleep() or execute some other code that will consume some noticeable number of seconds between calls to time() function. cwr illustrated one way of doing that, but you wouldn't want to use that technique in an actual program because the time will vary from one computer to another. you should use the system's sleep() in *nix or Sleep() in Windows for consistant delays on different computers.