PHP file modification time in milliseconds

Posted by Steven Rosato on Stack Overflow See other posts from Stack Overflow or by Steven Rosato
Published on 2010-05-27T18:34:28Z Indexed on 2010/05/28 9:41 UTC
Read the original article Hit count: 162

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about php5

Related posts about milliseconds