On Sat, Apr 04, 2015 at 12:47:15AM +0000, Keller, Jacob E wrote:
> Hey Richard, and others,
> 
> I am currently implementing a timecounter setup for a device which
> (nominally) represents time as
> 
> Field1: 32bits, Seconds
> Field2: 32bits, Nanoseconds (never > 999,999,999)
> 
> I do the math to convert this to u64 nanoseconds, and provide this to a
> cycle counter.

So, I guess you want to do this because your HW has this split
representation, but you cannot adjust the frequency?
 
> I think the timecounter code is actually incorrect, because it doesn't
> allow for arbitrary overflow points....

I think the timecounter is okay.  Your problem is that the timecounter
uses base-2 counting, but your clock counts 10^9 nanoseconds (base-10).

> Any suggestions or thoughts on the timecounter stuff?

32 bits of seconds gives you 136 years of uptime (assuming the counter
starts at zero).  You can just use a 64 bit mask and forget about the
overflow, since it can never happen in practice.


HTH,
Richard

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to