<p>Sometimes I have to work on code that moves the computer clock forward. In this case some .cpp or .h files get their latest modification date set to the future time.</p>

<p>Later on, when my clock is fixed, and I compile my sources, system rebuilds most of the project because some of the latest modification dates are in the future.  Each subsequent recompile has the same problem.</p>

<p>Solution that I know are:</p>

<p>a) Find the file that has the future time and re-save it. This method is not ideal because the project is very big and it takes time even for windows advanced search to find the files that are changed.</p>

<p>b) Delete the whole project and re-check it out from svn.</p>

<p>Does anyone know how I can get around this problem?</p>

<p>Is there perhaps a setting in visual studio that will allow me to tell the compiler to use the archive bit instead of the last modification date to detect source file changes?</p>

<p>Or perhaps there is a recursive modification date reset tool that can be used in this situation?</p>

[{'answer_id': 60984, 'author': 'Michael Neale', 'author_id': 699, 'author_profile': 'https://Stackoverflow.com/users/699', 'pm_score': 0, 'selected': False, 'text': '<p>I don\'t use windows - but surely there is something like awk or grep that you can use to find the "future" timestamped files, and then "touch" them so they have the right time - even a perl script.</p>\n'}, {'answer_id': 60985, 'author': 'Maximilian', 'author_id': 1733, 'author_profile': 'https://Stackoverflow.com/users/1733', 'pm_score': 1, 'selected': False, 'text': "<p>I don't know if this works in your situation but how about you don't move your clock forward, but wrap your gettime method (or whatever you're using) and make it return the future time that you need?</p>\n"}, {'answer_id': 61015, 'author': 'Nathan Jones', 'author_id': 5848, 'author_profile': 'https://Stackoverflow.com/users/5848', 'pm_score': 1, 'selected': False, 'text': '<p>Install <a href="http://unxutils.sourceforge.net/" rel="nofollow noreferrer">Unix Utils</a></p>\n\n<pre><code>touch temp\nfind . -newer temp -exec touch {} ;\nrm temp\n</code></pre>\n\n<p>Make sure to use the full path when calling find or it will probably use Windows\' find.exe instead. This is untested in the Windows shell -- you might need to modify the syntax a bit.</p>\n'}, {'answer_id': 61016, 'author': 'Greg Hewgill', 'author_id': 893, 'author_profile': 'https://Stackoverflow.com/users/893', 'pm_score': 3, 'selected': False, 'text': '<p>I would recommend using a virtual machine where you can mess with the clock to your heart\'s content and it won\'t affect your development machine. Two free ones are <a href="http://www.microsoft.com/Windows/products/winfamily/virtualpc/default.mspx" rel="nofollow noreferrer">Virtual PC</a> from Microsoft and <a href="http://www.virtualbox.org/" rel="nofollow noreferrer">VirtualBox</a> from Sun.</p>\n'}, {'answer_id': 61105, 'author': 'Jay Bazuzi', 'author_id': 5314, 'author_profile': 'https://Stackoverflow.com/users/5314', 'pm_score': 2, 'selected': True, 'text': '<p>If this was my problem, I\'d look for ways to avoid mucking with the system time.  Isolating the code under unit tests, or a virtual machine, or something.</p>\n\n<p>However, because I love <a href="https://stackoverflow.com/questions/52487/the-most-amazing-pieces-of-software-in-the-world#53414">PowerShell</a>:</p>\n\n<pre><code>Get-ChildItem -r . | \n    ? { $_.LastWriteTime -gt ([DateTime]::Now) } | \n    Set-ItemProperty -Name "LastWriteTime" -Value ([DateTime]::Now)\n</code></pre>\n'}, {'answer_id': 65297, 'author': 'Greg Rogers', 'author_id': 5963, 'author_profile': 'https://Stackoverflow.com/users/5963', 'pm_score': 0, 'selected': False, 'text': '<p>1) Use a build system that doesn\'t use timestamps to detect modifications, like <a href="http://www.scons.org" rel="nofollow noreferrer">scons</a></p>\n\n<p>2) Use <a href="http://ccache.samba.org/" rel="nofollow noreferrer">ccache</a> to speed up your build system that does use timestamps (and rebuild all).</p>\n\n<p>In either case it is using md5sum\'s to verify that a file has been modified, not timestamps.</p>\n'}]
['https://Stackoverflow.com/questions/60977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3153/']