[U-Boot] [RFC][Timer API] Revised Specification - Implementation details

Wolfgang Denk wd at denx.de
Tue May 31 07:49:53 CEST 2011


Dear Simon Glass,

In message <BANLkTi=T_pzB9TOPtQuNZXarvQsHN80P3g at mail.gmail.com> you wrote:
>
> I do think it would be nice to put a time_ prefix before all the time
> functions, but this is a pretty minor point.

Agree.

By now, I also find get_timer() kind of misleading - one might expect
from that name that it allocates one of (eventually several available)
timers.  We should probably rename it into  time_read(); the newly
suggested function would then become  time_delta() [or time_diff()].

> See my other message about computing a future time. But the less

I disagree with this, mostly because it seems a too narrow design to
me.  There is not always and only the need for "wait-until-time-X"
type of tasks.  The  time_delta()  way to do things also gives you the
option to compare timestamps that have been recorded any time before.

> ad-hoc time calculation we can leave to callers of get_timer() the
> better. I think these things are actually a sign of an API which is
> too low level. There is a certain purity and simplicity with
> get_timer(), sort of minimalist, but the ugly constructs that people
> build on top of it need to be considered and brought into the equation
> too.

It is certainly a good idea to provide simple and reliable ways for
standard tasks - but see sig below.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"UNIX was not designed to stop you from doing stupid things,  because
that would also stop you from doing clever things."       - Doug Gwyn


More information about the U-Boot mailing list