RetroBSD
http://retrobsd.org/

time_info.tv_usec resolution
http://retrobsd.org/viewtopic.php?f=7&t=37533
Page 1 of 1

Author:  Pito [ Fri Feb 12, 2016 11:11 am ]
Post subject:  time_info.tv_usec resolution

Code:
struct timeval  time_info;
long tstart, tstop, elapsed;
long micros(){
   gettimeofday(&time_info, 0);
   return (time_info.tv_sec * 1000000L + time_info.tv_usec);
}


Why the time_info.tv_usec resolution is 10ms in RetroBSD, SmallerC?
Cannot be made better?

Author:  Pito [ Sat Feb 13, 2016 12:13 am ]
Post subject:  Re: time_info.tv_usec resolution

Precise interval measurement - maybe we shall run a 32bit hw timer, fed by 1MHz or something like that, and read via a syscall (micros()). That allows for 72minutes at 1us resolution.

Author:  wiz [ Sat Feb 13, 2016 8:06 pm ]
Post subject:  Re: time_info.tv_usec resolution

Hi Pito,

I just read the CPU counter directly. Store that and do the math later. I suppose an interrupt routine could extend the counter to whatever number of digits makes sense for applications needing longer intervals.

Lots of fun :).

Wiz

Author:  Pito [ Sun Feb 14, 2016 10:42 am ]
Post subject:  Re: time_info.tv_usec resolution

You cannot read cpu tick timer directly.. Moreover it runs over in 107secs.

Author:  wiz [ Sun Feb 14, 2016 8:58 pm ]
Post subject:  Re: time_info.tv_usec resolution

Hi Pito,

IIRC I did it with a syscall.

Wiz

Author:  vak [ Fri Feb 19, 2016 6:50 am ]
Post subject:  Re: time_info.tv_usec resolution

Pito wrote:
Why the time_info.tv_usec resolution is 10ms in RetroBSD, SmallerC?
Cannot be made better?

This problem has been solved in LiteBSD. A special machine-dependent routine microtime() is used to obtain a time value with microsecond precision. It should be pretty easy to back-port to RetroBSD kernel as well.

Author:  Pito [ Tue Feb 23, 2016 8:13 am ]
Post subject:  Re: time_info.tv_usec resolution

The retrobsd community would be happy if you may put that on your todo list, plz :)

Author:  Sumland [ Mon Nov 20, 2017 2:54 pm ]
Post subject:  Re: time_info.tv_usec resolution

Has this issue been resolved? I remember I've had the same problem, but I stopped using the software soon after.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/