Message ID | 1449677301-3254-2-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
My earlier patch http://patches.opendataplane.org/patch/4080/ deals with this in a more general manner. On Wed, Dec 9, 2015 at 10:08 AM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > platform/linux-generic/odp_time.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/platform/linux-generic/odp_time.c > b/platform/linux-generic/odp_time.c > index 1d374ca..500ba4b 100644 > --- a/platform/linux-generic/odp_time.c > +++ b/platform/linux-generic/odp_time.c > @@ -27,7 +27,7 @@ uint64_t time_to_ns(odp_time_t time) > static inline > odp_time_t time_diff(odp_time_t t2, odp_time_t t1) > { > - struct timespec time; > + odp_time_t time; > > time.tv_sec = t2.tv_sec - t1.tv_sec; > time.tv_nsec = t2.tv_nsec - t1.tv_nsec; > @@ -43,7 +43,7 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1) > odp_time_t odp_time_local(void) > { > int ret; > - struct timespec time; > + odp_time_t time; > > ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); > if (odp_unlikely(ret != 0)) > @@ -64,7 +64,7 @@ uint64_t odp_time_to_ns(odp_time_t time) > > odp_time_t odp_time_local_from_ns(uint64_t ns) > { > - struct timespec time; > + odp_time_t time; > > time.tv_sec = ns / ODP_TIME_SEC_IN_NS; > time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS; > @@ -85,7 +85,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1) > > odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2) > { > - struct timespec time; > + odp_time_t time; > > time.tv_sec = t2.tv_sec + t1.tv_sec; > time.tv_nsec = t2.tv_nsec + t1.tv_nsec; > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
On 12/09/2015 19:30, Bill Fischofer wrote: > My earlier patch http://patches.opendataplane.org/patch/4080/ deals > with this in a more general manner. yes, that patch is not needed now. Maxim. > > On Wed, Dec 9, 2015 at 10:08 AM, Maxim Uvarov <maxim.uvarov@linaro.org > <mailto:maxim.uvarov@linaro.org>> wrote: > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org > <mailto:maxim.uvarov@linaro.org>> > --- > platform/linux-generic/odp_time.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/platform/linux-generic/odp_time.c > b/platform/linux-generic/odp_time.c > index 1d374ca..500ba4b 100644 > --- a/platform/linux-generic/odp_time.c > +++ b/platform/linux-generic/odp_time.c > @@ -27,7 +27,7 @@ uint64_t time_to_ns(odp_time_t time) > static inline > odp_time_t time_diff(odp_time_t t2, odp_time_t t1) > { > - struct timespec time; > + odp_time_t time; > > time.tv_sec = t2.tv_sec - t1.tv_sec; > time.tv_nsec = t2.tv_nsec - t1.tv_nsec; > @@ -43,7 +43,7 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1) > odp_time_t odp_time_local(void) > { > int ret; > - struct timespec time; > + odp_time_t time; > > ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); > if (odp_unlikely(ret != 0)) > @@ -64,7 +64,7 @@ uint64_t odp_time_to_ns(odp_time_t time) > > odp_time_t odp_time_local_from_ns(uint64_t ns) > { > - struct timespec time; > + odp_time_t time; > > time.tv_sec = ns / ODP_TIME_SEC_IN_NS; > time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS; > @@ -85,7 +85,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1) > > odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2) > { > - struct timespec time; > + odp_time_t time; > > time.tv_sec = t2.tv_sec + t1.tv_sec; > time.tv_nsec = t2.tv_nsec + t1.tv_nsec; > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> > https://lists.linaro.org/mailman/listinfo/lng-odp > >
On 9 December 2015 at 19:22, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 12/09/2015 19:30, Bill Fischofer wrote: > >> My earlier patch http://patches.opendataplane.org/patch/4080/ deals with >> this in a more general manner. >> > > yes, that patch is not needed now. > I assume Bill meant that a more general solution is preferable to a more specific (less general) solution. In general (huhu) I think this is a good idea. > > Maxim. > >> >> On Wed, Dec 9, 2015 at 10:08 AM, Maxim Uvarov <maxim.uvarov@linaro.org >> <mailto:maxim.uvarov@linaro.org>> wrote: >> >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org >> <mailto:maxim.uvarov@linaro.org>> >> --- >> platform/linux-generic/odp_time.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/platform/linux-generic/odp_time.c >> b/platform/linux-generic/odp_time.c >> index 1d374ca..500ba4b 100644 >> --- a/platform/linux-generic/odp_time.c >> +++ b/platform/linux-generic/odp_time.c >> @@ -27,7 +27,7 @@ uint64_t time_to_ns(odp_time_t time) >> static inline >> odp_time_t time_diff(odp_time_t t2, odp_time_t t1) >> { >> - struct timespec time; >> + odp_time_t time; >> >> time.tv_sec = t2.tv_sec - t1.tv_sec; >> time.tv_nsec = t2.tv_nsec - t1.tv_nsec; >> @@ -43,7 +43,7 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1) >> odp_time_t odp_time_local(void) >> { >> int ret; >> - struct timespec time; >> + odp_time_t time; >> >> ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); >> > Are we sure we can use &time (of type odp_time_t pointer) as a parameter to clock_gettime? Me thinks we should have a temporary variable of type struct timespec that we pass to clock_gettime(). The we use the relevant fields from this variable to compute the return value (of type odp_time_t). This should work even if struct timespec and odp_time_t are defined in different ways. if (odp_unlikely(ret != 0)) >> @@ -64,7 +64,7 @@ uint64_t odp_time_to_ns(odp_time_t time) >> >> odp_time_t odp_time_local_from_ns(uint64_t ns) >> { >> - struct timespec time; >> + odp_time_t time; >> >> time.tv_sec = ns / ODP_TIME_SEC_IN_NS; >> time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS; >> @@ -85,7 +85,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1) >> >> odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2) >> { >> - struct timespec time; >> + odp_time_t time; >> >> time.tv_sec = t2.tv_sec + t1.tv_sec; >> time.tv_nsec = t2.tv_nsec + t1.tv_nsec; >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> >> https://lists.linaro.org/mailman/listinfo/lng-odp >> >> >> > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index 1d374ca..500ba4b 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -27,7 +27,7 @@ uint64_t time_to_ns(odp_time_t time) static inline odp_time_t time_diff(odp_time_t t2, odp_time_t t1) { - struct timespec time; + odp_time_t time; time.tv_sec = t2.tv_sec - t1.tv_sec; time.tv_nsec = t2.tv_nsec - t1.tv_nsec; @@ -43,7 +43,7 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1) odp_time_t odp_time_local(void) { int ret; - struct timespec time; + odp_time_t time; ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); if (odp_unlikely(ret != 0)) @@ -64,7 +64,7 @@ uint64_t odp_time_to_ns(odp_time_t time) odp_time_t odp_time_local_from_ns(uint64_t ns) { - struct timespec time; + odp_time_t time; time.tv_sec = ns / ODP_TIME_SEC_IN_NS; time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS; @@ -85,7 +85,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1) odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2) { - struct timespec time; + odp_time_t time; time.tv_sec = t2.tv_sec + t1.tv_sec; time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/odp_time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)