I originally posted this in http://arduino.cc/forum/index.php/topic,125510.0.html but since it appears to be a bug I will repost it here as well.
In the WebClientRepeating sample code for the Ethernet library there is a line for determining the posting interval. The line is
const unsigned long postingInterval = 60*1000; // delay between updates, in milliseconds
The problem is the actual value of the postingInterval is wrong when I print it out (it is 4294961760). It seems to be a casting/overflow problem with the compiler/preprocessor. It looks like it is treating the 60 and 1000 as signed integers.
I broke this out into very short sample code to demonstrate:
const unsigned long postingInterval = 60*1000;
const unsigned long postingIntervalB = (long)60*1000;
void setup() {
Serial.begin(9600);
Serial.println(postingInterval);
Serial.println(postingIntervalB);
}
void loop() {}
When I run this I get back the following values:
4294961760
60000
Other Ethernet samples use 10 seconds (10*1000) and do not appear to have this problem. I assume it is because it is withing the range of an signed integer and that is how the compiler/preprocessor is treating the values.