using gettimeof day pj_get_timestamp

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

 



Samuel Vinson wrote:
> Hi Benny,
> 
> Why do you use gettimeofday un pj_get_timestamp and not pj_gettimeofday ?
> On Nintendo DS gettimeofday doesn't work so I wrote gettimeofday in 
> os_time_nds.


Hi Samuel,

it's mainly to get better precision, since pj_gettimeofday() only 
has milliseconds precision, while with gettimeofday() we could get 
microseconds precision (at least at API level). And the timestamp 
API is all about precision, so I felt it's better to use that.

What about putting these in a separate file, say os_timestamp_nds.c?

cheers,
  -benny

> But I won't modify several files. So you could use this code in 
> os_timestamp_posix.c
> 
> PJ_DEF(pj_status_t) pj_get_timestamp(pj_timestamp *ts)
> {
>     pj_time_val tv;
> 
>     if (pj_gettimeofday(&tv) != PJ_SUCCESS) {
>     return PJ_RETURN_OS_ERROR(pj_get_native_os_error());
>     }
> 
>     ts->u64 = tv.sec;
>     ts->u64 *= USEC_PER_SEC;
>     ts->u64 += tv.msec * 1000;
> 
>     return PJ_SUCCESS;
> }
> 
> Best regards,
> 
> Samuel





[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux