hall@trout.NOSC.MIL (Robert R. Hall) (03/15/88)
I found that not only was ldclock setting the date ahead by one day but that date -q command would do the same thing. Also if I tried to set the date 31 Dec 1988, I got a negative value for time. To correct the behavior here are the changes I made: These diff file are relative to version 1.1 I done have seen any changes to these file for version 1.2 If there were some I missed them ------------------------ ldclock.dif ---------------------------- 24,25c24 < int days[] = {0,31,59,90,120,151,181,212,243,273,304,334, < 0,31,60,91,121,152,182,213,244,274,305,335}; --- > int days[] = {0,31,59,90,120,151,181,212,243,273,304,334}; 48c47 < ct += (long) (days[leap*12+mnth-1]+dt-1+extra)*86400; --- > ct += (long) (days[mnth-1]+dt-1+extra)*86400; ------------------------------------------------------------------------ ------------------------- date.dif ---------------------------- 5c5 < int qflag; --- > int qflag = 0; 34a35,36 > time(&t); > cv_time(t); 49,50d50 < time(&t); < cv_time(t); 58a59,60 > long t_inc; > 65,67c67,70 < while (t >= s_p_year) { < if (((tm.year + 2) % 4) == 0) < t -= s_p_day; --- > t_inc = s_p_year; > if (((tm.year + 2) % 4) == 0) > t_inc += s_p_day; > while (t >= t_inc) { 69c72,75 < t -= s_p_year; --- > t -= t_inc; > t_inc = s_p_year; > if (((tm.year + 2) % 4) == 0) > t_inc += s_p_day; 71,72d76 < if (((tm.year + 2) % 4) == 0) < days_per_month[1]++; 73a78,81 > if ((tm.year % 4) == 0) > days_per_month[1] = 29; > else > days_per_month[1] = 28; 95c103 < long ct, time(); --- > long ct; 98,100d105 < time(&ct); < cv_time(ct); < tm.year -= 1970; 113c118 < tm.year = conv(&tp, 99); --- > tm.year = conv(&tp, 99) + 1900; 116d120 < tm.year -= 70; 117a122,126 > if ((tm.year % 4) == 0) > days_per_month[1] = 29; > else > days_per_month[1] = 28; > tm.year -= 1970; 120,121d128 < if (((tm.year + 2) % 4) == 0) < days_per_month[1]++; 130,131d136 < if (days_per_month[1] > 28) < days_per_month[1] = 28; ------------------------------------------------------------------------ Robert R. Hall hall@nosc.mil