Deep sleep maximum time 8266

So this function is defined as

And thus uint64_t means the range of this value is between 0 and (2^64)-1 equals

18446744073709551615

your expression evaluates to

2220000000

which is below the max value; however you are doing int aka int32_t arithmetic when you don’t suffix the values with stuff like U, UL or ULL. And int32_t has a range of

−2147483648 (most negative)
2147483647 (most positive)

2220000000 (your number)

so as you can see you are above the int32_t limit; No need to worry though, just do unsigned long long arithmetic (for uint64_t) and write

 #define SleepTime (35ULL* 60ULL* 1000000ULL)

and you should be good to go.

Too-long-didn’t-read-version: You made a int32_t overflow, use ULLto calculate sleep time as the correct uint64_t value.

1 Like