9fans archive / 1999 / 01 / 53 / prev next
From: G. David Butler gdb@dbS...
Subject: [9fans] Some plan9 y2k problems
Date: Thu, 21 Jan 1999 21:01:00 -0600
>to guard against systems on which (-1)%7 == 1?
[checking K&R, yup the sign of % with
negative arguments is machine dependent]
How about this?
xtime.wday = (day + 4) % 7;
if(day < 0) {
if(xtime.wday > 0)
xtime.wday *= -1;
xtime.wday += 7;
}
The reason I care is 7340036 fits easily in a vlong...