From c70b37af647821a882ef14129c57c895a0f2e3ee Mon Sep 17 00:00:00 2001 From: cascade Date: Fri, 8 Oct 2004 21:13:25 +0000 Subject: [PATCH] OCC5916 Correction of time compensation mechanism cxx only --- src/WOKBuilder/WOKBuilder_MSTranslator.cxx | 88 +++++++++++++++++++--- 1 file changed, 78 insertions(+), 10 deletions(-) diff --git a/src/WOKBuilder/WOKBuilder_MSTranslator.cxx b/src/WOKBuilder/WOKBuilder_MSTranslator.cxx index 18329e7..ff59ed5 100755 --- a/src/WOKBuilder/WOKBuilder_MSTranslator.cxx +++ b/src/WOKBuilder/WOKBuilder_MSTranslator.cxx @@ -8,6 +8,35 @@ #include #include +#include + +#ifndef DONT_COMPENSATE +#include + +#ifdef WNT +# include +#endif // WNT + +#ifdef HAVE_UNISTD_H +# include +#endif + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#if defined (HAVE_SYS_STAT_H) || defined (WNT) +# include +#endif +#include + +#if defined(HAVE_TIME_H) || defined(WNT) +# include +#endif + +#include +#endif // DONT_COMPENSATE + #include @@ -127,7 +156,7 @@ WOKBuilder_MSActionStatus WOKBuilder_MSTranslator::MSActionStatus(const Handle(W const Handle(WOKBuilder_Specification)& anewcdl) const { WOKBuilder_MSActionID anid(anaction->Entity()->Name(), anaction->Type()); - + Standard_Integer decal = 0; switch(MSchema()->GetActionStatus(anid)) { case WOKBuilder_HasFailed: @@ -176,9 +205,10 @@ WOKBuilder_MSActionStatus WOKBuilder_MSTranslator::MSActionStatus(const Handle(W case WOKBuilder_Uses: case WOKBuilder_SchUses : case WOKBuilder_GlobEnt: - { - Handle(WOKBuilder_Specification) oldspec = oldaction->Entity()->File(); - + + { +#ifndef DONT_COMPENSATE + Handle(WOKBuilder_Specification) oldspec = oldaction->Entity()->File(); if(!oldspec.IsNull()) { if(!oldspec->Path()->Name()->IsSameString(anewcdl->Path()->Name())) @@ -191,15 +221,53 @@ WOKBuilder_MSActionStatus WOKBuilder_MSTranslator::MSActionStatus(const Handle(W } else { - WOK_TRACE { - VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus" + WOK_TRACE { + VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus" << "NewFile : " << anewcdl->Path()->Name() << " is same than old : " << oldspec->Path()->Name() << endm; - } + } } - } - - if(anewcdl->Path()->MDate() > oldaction->Date()) + } + TCollection_AsciiString tempath1 = anewcdl->Path()->Name()->ToCString(); + Standard_CString tempath = tempath1.ToCString(); + Standard_Integer fd; + + if((fd=open(tempath, O_RDONLY)) == -1) + { + WarningMsg << "WOKStep_MSFill::Execute" + << "Could not create : " << tempath << endm; + perror(tempath); + } + else + { + close(fd); + } + + if(fd != -1 ) + { + struct stat buf; + if(stat(tempath, &buf)) + { + ErrorMsg << "WOKStep_MSFill::Execute" + << "Could not stat : " << tempath << endm; + } + + time_t curdate ; + curdate = time(NULL); + + if(curdate == -1) + { + ErrorMsg << "WOKStep_MSFill::Execute" + << "Could not obtain current date" << endm; + } + if(buf.st_atime - curdate > 0) + { + decal = buf.st_atime - curdate; + } + } +#endif // DONT_COMPENSATE + + if(anewcdl->Path()->MDate()- decal > oldaction->Date()) { WOK_TRACE { VerboseMsg("WOK_TRANSIT") << "WOKBuilder_MSTranslator::MSActionStatus" -- 2.39.5