With this:-
time = millis();
delay(1000);
Serial.println(time);
All you are doing is measuring the time, hanging about a bit then printing it. Did you mean:-
time = millis();
delay(1000);
Serial.println(millis() - time);
That should give you 1000 (or 1001) every time.