in reply to Epoch mod time for files

You're using a very convoluted way of getting the $time value.

Use this instead:

$time = time();

Michael