From: Bill Fischofer [mailto:bill.fischo...@linaro.org] 
Sent: Friday, April 28, 2017 10:09 PM
To: Petri Savolainen <petri.savolai...@linaro.org>
Cc: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [API-NEXT PATCH v3 01/11] api: time: remove 
odp_time_to_u64 from API

I agree that the validation test for odp_time_to_u64() is suspect and should be 
fixed, but why remove this API? We've established that various abstract types 
have odp_xxx_to_u64() routines designed for debugging use and this makes 
odp_time_t an exception to that rule.

[Petri]
xxx_to_u64() is needed when application does not have any other way e.g. to 
print out a handle, since handle type sizes are unknown in advance. Odp_time_t 
is not a handle to resource, but an abstract value - and more importantly the 
API has a well-defined odp_time_t -> u64 conversion function already (namely 
odp_time_to_ns()). There's no need or much value in having two conversion 
functions. Actually, it's a source of confusion, if we have two functions. Also 
when debugging, conversion to nsec time is more valuable to the user, than 
conversion to an abstract 64 bit value (which would be implemented as 64bit 
nsec in most cases anyway). 


Also, shouldn't we deprecate it if we want to remove it? What's the point of 
having the deprecation framework in place if we're not going to bother with it?

[Petri]
In this case, application have had always two choices for the same conversion, 
and I think odp_time_to_ns() has been the natural choice for that. So, I expect 
that odp_time_to_u64() has not been used at all - e.g. our code base didn't. 
Deprecation must be used when application does not have a choice (e.g. old name 
vs. new name). Here an application has two choices and is still backwards 
compatible after changing all odp_time_to_u64() calls to odp_time_to_ns().

Also the proper deprecation framework is not in the repo yet. I have 
waited/pinged for that (v2) to happen a month now.

-Petri



On Fri, Apr 28, 2017 at 7:09 AM, Petri Savolainen 
<mailto:petri.savolai...@linaro.org> wrote:
Debug function that converts odp_time_t to u64 is unnecessary
since odp_time_to_ns() returns time as a u64 (nsec) value.
Application can always use that as the 64 bit representation
of an odp_time_t value. Also validation tests for odp_time_to_ns()
were erroneous since those compared returned u64 values and
expected greater/lesser than relation.



Reply via email to