Well you could always make your own, but before going there, let me ask, are you saying that you need to time an event that lasts longer than 70 minutes down to microsecond accuracy? That's 0.24 parts per billion if I did the maths right. On 16MHz boards, micros() has a resolution of 4µs, so that'd still be 1ppb.
er
I may be slightly confused (normal state some say) but...
I don't want to step once every 70 minutes, but I want to continue stepping past 70 minutes
now, up to 70 minutes micros() returns a monotonically increasing number
but if I start my measurement just before the 70 minutes is up
startTime = micros();
and I want to wait 1.5 mS (1500 microseconds),
then the test
and I want to wait 1.5 mS (1500 microseconds),
then the test
if (micros() - startTime > 1500)
will never happen
Would you like to place a small wager on that? Subtraction involving unsigned longs is guaranteed to work, as long as the value has not rolled over more than once.
mmcp42:
er
I may be slightly confused (normal state some say) but...
I don't want to step once every 70 minutes, but I want to continue stepping past 70 minutes
now, up to 70 minutes micros() returns a monotonically increasing number
but if I start my measurement just before the 70 minutes is up
startTime = micros();
and I want to wait 1.5 mS (1500 microseconds),
then the test
if (micros() - startTime > 1500)
will never happen
Your intuition is wrong, it will indeed happen exactly when you want it to. micros() returns an unsigned long, so the maths will be done modulo 2^32. You should declare startTime as "unsigned long".
The Arduino does also support the long long datatype aka uint64_t . This is a 64 bit integer, and you could make a micros() timer that increases the uint64_t.
You still should handle the micros() overflow you you got a counter that can count up to 2^64-1 = 18446744073709551615 micros =~ 584942 years.
Warning doing Math with long long is time intensive.
tempting though it is to build a system that would run for half a million years
I suspect something else may give up before that
I include myself in that list
in fact, pretty near the top of the list!
tempting though it is to build a system that would run for half a million years
I suspect something else may give up before that
I include myself in that list
in fact, pretty near the top of the list!