Menu

#3 Fix: Needless rebuilds on Unix

closed-fixed
None
5
2003-02-17
2002-12-08
No

The appended patch fixes a rebuild problem on fast Unix
machines.
Cpptasks builds object, library and executeable files
on such
machines with a high probability needless again and
again. This
is caused by an unappropiated comperation between
system time
(get by System.currentTimeMillis()) and last file
modification
time (get by File.lastModified()) in class
TargetHistoryTable.

Many (all ?) Unix systems (exspecially Linux) stores file
modification times only in seconds, not in
milliseconds. So the
last three decimal digits of the return value of
File.lastModified() are always zero. But the return
value of
System.currentTimeMillis() are really milliseconds.
Because of
this behaviour the modification time of build files
seems to be
on fast machines often *older* then the compile or link
start
time. If this happens, cpptasks doesn't update the
history file
and builds up the just created file next time again.

Only if System.currentTimeMillis() delivers a time
close to the
next second (like xxxxx0900) and File.lastModiefied()
delivers a
timestamp from this next second (like xxxxx10000) or the
compile/link job takes more then a second, cpptasks works
correct.

Cpptasks can try to round down system times from
System.currentTimeMillis() to solve this problem, but other
systems could use other time resolutions. The best
solution is to
avoid comperation between system time and file
timestamps at all.
So I patched TargetHistoryTable to compare build file
times with
the modification time of the history file. The history
file is
updated, if created files are newer or from the same time
(greater or equal, because seconds are a bad time
resolution!).

If these patch is applied or the problem is solved in
another
way, please publish a new beta version of cpptasks. The
developers of our project (OpenSHORE) can then easily
use the
corrected version. Thank you!

If you have any questions, please write a mail to my
SourceForge
address.

Helge Schulz

--
Helge Schulz
http://www.openshore.org

Discussion

  • Helge Schulz

    Helge Schulz - 2002-12-08

    cpptasks-unix-rebuild.patch

     
  • Helge Schulz

    Helge Schulz - 2002-12-08

    Logged In: YES
    user_id=620518

    My patch was not attached.

     
  • Curt Arnold

    Curt Arnold - 2003-02-17

    Logged In: YES
    user_id=27193

    Patch applied and added test
    TestTargetHistoryTable.testUpdateTimeResolution

     
  • Curt Arnold

    Curt Arnold - 2003-02-17
    • assigned_to: nobody --> carnold
    • status: open --> closed-fixed
     

Log in to post a comment.