On Dec 30, 2017, at 6:18 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote:

On Fri, Dec 29, 2017 at 10:30:17PM -0500, Programmingkid wrote:

On Dec 29, 2017, at 8:01 PM, BALATON Zoltan <balaton@eik.bme.hu> wrote:

I've tried to implement it the way I've suggested and came up with the 
patch below, but it does not seem to work. I think this is because the 
arithmetic in get-msec overflows and does not get the right values. Could 
it be it works in SLOF because that runs on 64bit? Or is something needed 
to tell Forth to use 64bit values on PPC32? Any ideas?

I continuously printed the tb@ word's value by using this program:

decimal
begin
tb@ . .
cr
again

The tbu value looks right. The tbl value is a problem. When it prints it sometimes prints as a negative value.

You should use  U.   .


   printf("or'ed value: %" PRId64 "\n", (uint64_t)((tbu << 32) | tbl));  // should be 8,294,967,296

And that should be  (uint64_t)tbu << 32   (note where the cast is done).


Segher

Maybe not on topic, but 1000 ms and 1000000 us, return the correct time on SLOF.

I would think this is related to having the correct timebase, but maybe I misunderstand how these things work.