[comp.os.minix] bug in ctime

n62@nikhefh.hep.nl (Klamer Schutte) (05/30/89)

I found the following bug in ctime.c: It always prints
Thu (thursday) as the day.
Here is my fix:

(.signature at end )
*** ctime.c~	Tue May 30 12:05:43 1989
--- ctime.c	Tue May 30 12:12:49 1989
***************
*** 55,62 ****
  		tm.tm_min++;
  	}
  	tm.tm_sec = (int) t;
! 	sprintf(buf, "%s %s %2d %02d:%02d:%02d %d\n",
! 		days[(t / DAY) % 7], months[tm.tm_mon],
  		tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year); 
  	return buf;
  }
--- 55,63 ----
  		tm.tm_min++;
  	}
  	tm.tm_sec = (int) t;
! 	/* t is changed so use *pt for the name of the day */
! 	sprintf(buf, "%s %s %2d %02d:%02d:%02d %d\n",
! 		days[(*pt / DAY) % 7], months[tm.tm_mon],
  		tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year); 
  	return buf;
  }
-- 
________________________________________________________________________________
Klamer Schutte			mcvax!nikhefh!n62	      n62@nikhefh.hep.nl