Accurate Timestamp On T4.0

Status
Not open for further replies.

Don Kelly

Well-known member
I'm testing out TimeLib.h for getting an accurate (us) timestamp on sensor readings. I'm able to run the TimeTeensy3 example just fine, but not seeing how I use TimeLib to get a us-level timestamp. I suppose I could use micro() somehow and try to line that up with every one-second interval, but seems like there's probably an easier way.

P.S. I searched the forum and didn't see this explicitly. Apologize if I missed this if it's already been addressed.
 
Update:
Got a 1sec RTC interrupt timer working (derived from code posted in the forum). So I just need to add my own uSec sub-timer. But am still surprised there's not a lib out there that allows us to easily (precisely) timestamp an incoming sensor reading. If someone has seen one, I'd appreciate a link!
 
although most of the T4 RTC example sketches just return seconds. The T4 RTC registers (2 32-bit registers) actually count 32768 ticks, so you could get sub-second values at a precision of 1/32768. of course if you don't need time-of-day values, micros() will give you microsecond resolution timestamps.
 
Status
Not open for further replies.
Back
Top