Propeller C language: Why rc_time max = 249,987?
John Kauffman
Posts: 653
in Propeller 1
When I max out time on a Propeller C language rc_time() I get a return of 249987. Why that number? I don't think it is max size for int from C spec: ...Capable of containing at least the [−32767, +32767] range...
In BS2 PBASIC, an RCTIME return that is outside of bounds is 1 (too short) or 0 (too long), which is very convenient.
Thanks.
In BS2 PBASIC, an RCTIME return that is outside of bounds is 1 (too short) or 0 (too long), which is very convenient.
Thanks.
Comments
It looks like there's an st_timeout value that's part of the simple libs, and that is what's setting the maximum time. Because of the way RCtime works, if you had nothing connected at all, the decay would take (more or less) forever, so it has to be bounded somewhere. How long it takes in practice depends on your specific R/C circuit values, so having a timeout value that can be changed might be useful.
249987 is really close to 250,000 so my guess is that they're returning the answer in microseconds, and that would be 1/4 second.
Also, the Prop typically uses 32 bit ints, so values in the range of +/-2,147,000,000 ish.