tags:

views:

124

answers:

4

I'm connected to my Universities small Linux cluster via PuTTY and WinSCP, transferring files using the latter and compiling and running them with the former. My work so far as all been in the Uni labs and today I've been doing some work at home and hit an interesting warning.

I uploaded an entire folder of stuff and upon running make is does everything that I expected, but the last line of output is:

make: warning:  Clock skew detected.  Your build may be incomplete.

The resulting binary works correctly, and there doesn't seem to be any other unexpected errors in the build process.

I seem to be able to trigger the error by building after uploading some new / replacement files (I edit everything locally then upload the new version), so I'm wondering if it's something just as simple as mismatched file modification times? Or something more concerning?

So, should I be worried?
And how do I fix/prevent this?

A: 

This is usually simply due to mismatching times between your host and client machines. You can try to synchronize the times on your machines using ntp.

Soo Wei Tan
+1  A: 

According to user m9dhatter on LinuxQuestions.org:

"make" uses the time stamp of the file to determine if the file it is trying to compile is old or new. if your clock is bonked, it may have problems compiling.

if you try to modify files at another machine with a clock time ahead by a few minutes and transfer them to your machine and then try to compile it may cough up a warning that says the file was modified from the future. clock may be skewed or something to that effect ( cant really remember ). you could just ls to the offending file and do this:

#touch <filename of offending file>

yx
A: 

Make checks if the result of the compilation, e.g. somefile.o, is older than the source, e.g. somefile.c. The warning above means that something about the timestaps of the files is strange. Probably the system clocks of the University server differs from your clock and you e.g. push at 1 pm a file with modification date 2 pm. You can see the time at the console by typing date.

fschmitt
+7  A: 

That message is usually an indication that some of your files have modification times later than the current system time. Since make decides which files to compile when performing an incremental build by checking if a source files has been modified more recently than its object file, this situation can cause unnecessary files to be built, or worse, necessary files to not be built.

However, if you are building from scratch (not doing an incremental build) you can likely ignore this warning without consequence.

Tyler McHenry
It seems the cluster has a time ~3mins *behind* my desktop, so files having been modified in the "future" seems a likely cause. Is the safest bet then to wait 5mins or so after uploading anything before running a build? I'd rather not have to wait, so is there some way to reset the times on any uploaded "future" files to avoid the issue?
DMA57361
@DMA57361: `touch *` will update the mtimes to the current time. Alternatively you can enable NTP on your desktop to synch your clock (assuming it's your desktop that's wrong, and not the Uni's machine... if the latter, maybe ask the sysadmins to fix it?)
caf
Thanks for that, `touch *` it is for now, and I'll see if I can find out which is wrong and maybe have a word with the admin guy next time I'm on site.
DMA57361