[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TOD differences



Leon Pollak wrote:
> On Monday 05 November 2007 14:24, Joel Sherrill wrote:
>   
>> Leon Pollak wrote:
>>     
>>> Hello, all.
>>> The question seems to be very simple, but I did not find any answer in
>>> docs, wiki...
>>>
>>> I have two rtems_time_of_day structures containing two times. How can I
>>> calculate the difference (in seconds) between them?
>>>       
>> Not in the public API.  With the movement in 4.8 to struct timespec
>> in the super core, there are a lot of timespec math routines.  There
>> has always been some TOD to XXX routines.
>>
>> I have considered making the existing set of time math routines
>> available via the public API.  It isn't especially hard to do but
>> would require documentation.  If this is of interest to the
>> community, I will move it from my idea list to my someday we might
>> do this list.
>>     
> Thanks, Joel.
> I definitely do not represent the community :-), but I vote "pro"!
> Meanwhile, can you be so kind to "disclose" where I can find any 
> internal "TOD_to_XXX" routine?
>   
Depends on the version.  For 4.7 and older, the routine
you want is _TOD_To_seconds() from the SuperCore.

For 4.8 and newer, it has the same name but is part
of the RTEMS Classic API since the SuperCore doesn't
know the Classic API TOD structure any more.

libbsp/shared/tod.c has an example of using it.

In 4.8 and newer, there is also a set of timespec math
routines prototyped in score/include/rtems/score/timespec.h

--joel
> Again, thanks.
>