gettimeofday_rt available? NEW version

Gustavo gustavo at
Thu Jun 15 01:22:28 CEST 2006


Well, I implemented the code I sent this list before and it works.
I my case I'm running hard real time under user space with LXRT.
So, then I'm using a service provided by the RTAI modules to accomplish
the task instead of hanging on a normal linux call. Based on this, I
hope I still get in hard real time once the rtai modules provide
services enough reliable to maintain the calling tasks in LXRT under
hard real time also.
Makes sense?
By the way, Paolo, have you taken a look on the function I sent already?
I remember you asked my to wake you up in case you have forgotten...


Msc. Eng. Gustavo Baldo Carvalho
ZARM - Uni-Bremen - Room 1210
Am Fallturm, 28359 Bremen

Paolo Mantegazza wrote:
> Rodrigo Amestica wrote:
>> Hi Gustavo,
>> i'm using rtai-3.3 and in the source code I found that rt_gettimeorig
>> do something like this:
>> void rt_gettimeorig(RTIME time_orig[])
>> {
>> ...
>>         rtai_save_flags_and_cli(flags);
>>         do_gettimeofday(&tv);
>> ...
>> }
>> It is my impression that this is not right! Unless
>> rtai_save_flags_and_cli is doing some magic I'm not aware of then I
>> would insist that this is not right.
>> If for some reason the rtai context from where you are calling
>> rt_gettimeorig has preempted a linux context from where
>> do_settimeofday was called, or any other instance that it has locked
>> xtime_lock for _writing_, then do_gettimeofday from rt_gettimeorig
>> should while-loop for ever, hanging your machine.
>> It is my experience that this hanging _do_ happen on up and smp
>> architectures (always i386 in my case) at some point. Higher the
>> frequency at which I call do_gettimeofday from rtai more probable is
>> the hanging.
>> Please, let me know whether you think there is something wrong in my
>> argument or not.
> This has been discussed recently on this list. Rt_gettimeorig must not
> be called from a hard real time RTAI task but from an RTAI enabled Linux
> one. It will provide an aligned the timeofday aligned with the running
> time RTAI uses. Since the latter can be referred to in hard real time
> and its absolute time origin is known a user can safely reconstruct the
> absolute time while running in hard real time mode.
> Following the discussion on this list there has been a helper set of
> functions posted here recently.
> Paolo.

More information about the Rtai mailing list