PHP file modification time in milliseconds
- by Steven Rosato
I there, I am currently writing a unit test which asserts that a file did not get modified. The test code execution takes less than one second and therefore I would like to know if it is possible to retrieve the file modification time in milliseconds. filemtime() function returns the UNIX timestamp in seconds.
My current solution is using the sleep(1) function which will assure me that 1 second passed before checking if it was modified or not. I don't like that solution since it slows down the test by a great deal.
I cannot assert the content equality via get_file_contents() since the data that can be rewritten would be the same.
I am guessing it is impossible, is it?