hello,
Currenttly i'm trying to implement the clock_monotonic which was part of ticket
#3889. So far these are the changes are as follows
ptimer->clock_type= &clock_id;
in the timer create i added a field for the timer id and saved it when the
timer was made. Then in getttime I used the appropriate timers to get the time.
for example.
if (ptimer->clock_type ==CLOCK_REALTIME) {
Per_CPU_Control *cpu;
struct timespec spec;
struct timespec expire;
cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
_TOD_Get(spec);
_Timespec_From_ticks( expire, &ptimer->Timer.expire);
if (spec->tv.nsec+spec->tv.sec > expire->tv.nsec+expire->tv.sec ) {
remaining = (uint32_t) (expire->tv.nsec+expire->tv.sec -
spec->tv.nsec+spec->tv.sec);
} else {
remaining = 0;
}
_Timespec_From_ticks( remaining, &value->it_value );
value->it_interval = ptimer->timer_data.it_interval;
_POSIX_Timer_Release( cpu, &lock_context );
return 0;
}
Here i made two separate cases for getting the time. Also joel told me to I
feel that it is a bit redundant to call everything using timespec to
calculating remaining time and then just use timespec_From_ticks to get the
time. It was a recommendation from Joel. Did I make the correct change. Also I
assume that Delete does not need any changes because It does not require any
measuring of time. Is there anything i need to change for timer_settime?
Thanks
Zack
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel