January 20, 2001
Walter wrote ...
> Checking the code, it is most likely a bug in the time() runtime library function. The check has no affect on the rest of MAKE's operation, I only put it in because that was back in the bad old days where networks didn't synchronize clocks on all the computers connected. Having the computers all with different dates could produce some pretty wacky make results.
> 
> Try an experiment for me - write a little program to get the time via time()
> and print it out with ctime(). See if it is also off by an hour.

Hi Walter,

I tried a short test program:

   #include <time.h>
   #include <stdio.h>

   int main()
   {  time_t  t;
      time(&t);
      const char *s_time = ctime(&t);
      printf("time=%ld , ctime=%s\n", t, s_time);
      tm  loc_time = *localtime(&t);
      tm  gm_time  = *gmtime(&t);
      printf("loc_time = %s\n", asctime(&loc_time));
      printf("gm_time  = %s\n", asctime(&gm_time));
      printf("mktime(loc) = %ld\n", mktime(&loc_time));
      printf("mktime(gmt) = %ld\n", mktime(&gm_time));
      return 0;
   }

The result on my NT system is:

   time=979999687 , ctime=Sat Jan 20 15:08:07 2001

   loc_time = Sat Jan 20 15:08:07 2001

   gm_time  = Sat Jan 20 14:08:07 2001

   mktime(loc) = 979999687
   mktime(gmt) = 979996087

I've run this program on my Linux system and got the same behaviour there. So it seems that the actual implementation of time() is correct. Maybe the make problem comes from a use of gmtime() and localtime()?


	Heinz
January 22, 2001
This is a mystery, since this is what MAKE does:

----------------------------------------------------------------------
time_t getsystemtime()
{   time_t t;

    time(&t);

    /* FAT systems get their file times rounded up to a 2 second
       boundary. So we round up system time to match.
     */
    return (t + 2) & ~1;
}

time_t gettimex(name)
char *name;
{   time_t datetime;
    time_t systemtime;

    struct stat st;

    if (stat(name,&st) == -1)
        return 1L;
    datetime = st.st_mtime;
    systemtime = getsystemtime();
    if (datetime > systemtime)
    {
        printf("File '%s' is newer than system time.\n",name);
        printf("File time = %ld, system time = %ld\n",datetime,systemtime);
        printf("File time = '%s'\n",ctime(&datetime));
        printf("Sys  time = '%s'\n",ctime(&systemtime));
    }
    return datetime;
}


January 22, 2001
Walter schrieb...
> This is a mystery, since this is what MAKE does:
> 
> ----------------------------------------------------------------------
> time_t getsystemtime()
> {   time_t t;
> 
>     time(&t);
> 
>     /* FAT systems get their file times rounded up to a 2 second
>        boundary. So we round up system time to match.
>      */
>     return (t + 2) & ~1;
> }
> 
> time_t gettimex(name)
> char *name;
> {   time_t datetime;
>     time_t systemtime;
> 
>     struct stat st;
> 
>     if (stat(name,&st) == -1)
>         return 1L;
>     datetime = st.st_mtime;
>     systemtime = getsystemtime();
>     if (datetime > systemtime)
>     {
>         printf("File '%s' is newer than system time.\n",name);
>         printf("File time = %ld, system time = %ld\n",datetime,systemtime);
>         printf("File time = '%s'\n",ctime(&datetime));
>         printf("Sys  time = '%s'\n",ctime(&systemtime));
>     }
>     return datetime;
> }

Tried this code with a small test environment. It works! Compiled it
with sc -mn ftest.cpp and sc -mx ftest.cpp.
So could it be that make was compiled with an older library version
which had a bug?
Is it possible to recompile make and send be the recompiled version for
test?


	Heinz
January 23, 2001
There was one included in the DMC++ compiler update, and you can download one from www.digitalmars.com. Before you overwrite the one you have, see if it is the same or not. -Walter


Heinz Saathoff wrote in message ...
>Walter schrieb...
>> This is a mystery, since this is what MAKE does:
>>
>> ----------------------------------------------------------------------
>> time_t getsystemtime()
>> {   time_t t;
>>
>>     time(&t);
>>
>>     /* FAT systems get their file times rounded up to a 2 second
>>        boundary. So we round up system time to match.
>>      */
>>     return (t + 2) & ~1;
>> }
>>
>> time_t gettimex(name)
>> char *name;
>> {   time_t datetime;
>>     time_t systemtime;
>>
>>     struct stat st;
>>
>>     if (stat(name,&st) == -1)
>>         return 1L;
>>     datetime = st.st_mtime;
>>     systemtime = getsystemtime();
>>     if (datetime > systemtime)
>>     {
>>         printf("File '%s' is newer than system time.\n",name);
>>         printf("File time = %ld, system time =
%ld\n",datetime,systemtime);
>>         printf("File time = '%s'\n",ctime(&datetime));
>>         printf("Sys  time = '%s'\n",ctime(&systemtime));
>>     }
>>     return datetime;
>> }
>
>Tried this code with a small test environment. It works! Compiled it
>with sc -mn ftest.cpp and sc -mx ftest.cpp.
>So could it be that make was compiled with an older library version
>which had a bug?
>Is it possible to recompile make and send be the recompiled version for
>test?
>
>
> Heinz


January 24, 2001
Walter wrote...
> There was one included in the DMC++ compiler update, and you can download one from www.digitalmars.com. Before you overwrite the one you have, see if it is the same or not. -Walter

Downloaded that version, works!

This is what Dir showed on the old make:
  D:\sc\bin\make.exe
  10.01.97   6:50          65.024  make.exe

For the new make Dir shows
  E:\USERS\hsaat\make.exe
  23.01.01  10:56          51.200  make.exe

The new make is also significantly smaller than the older one. It must have come with one of the last Symantec C++ 7.50 CD. All other updates have been on the compiler and not make I think.

What I found out is that the old version of make also runs on a pure DOS-system whereas the new one requires 32-bit windows. Maybe that has caused the problem?


	Heinz


January 24, 2001
The old MAKE was a dual DOS/Win32 executable, in that an actual DOS MAKE was linked in as the "stub executable". So there were essentially two different programs merged into one file. (Doing that is a neat trick I discovered!)

The size dropped because I no longer included the old DOS MAKE as the stub executable.

But in any case, with the old MAKE, it still should have run the Win32 native version on a Win32 system.

At least it is working for you now <g>.


Heinz Saathoff wrote in message ...
>Walter wrote...
>> There was one included in the DMC++ compiler update, and you can download one from www.digitalmars.com. Before you overwrite the one you have, see
if
>> it is the same or not. -Walter
>
>Downloaded that version, works!
>
>This is what Dir showed on the old make:
>  D:\sc\bin\make.exe
>  10.01.97   6:50          65.024  make.exe
>
>For the new make Dir shows
>  E:\USERS\hsaat\make.exe
>  23.01.01  10:56          51.200  make.exe
>
>The new make is also significantly smaller than the older one. It must have come with one of the last Symantec C++ 7.50 CD. All other updates have been on the compiler and not make I think.
>
>What I found out is that the old version of make also runs on a pure DOS-system whereas the new one requires 32-bit windows. Maybe that has caused the problem?
>
>
> Heinz
>
>


1 2 3 4 5 6 7
Next ›   Last »