svn commit: samba r18614 - in branches/SAMBA_4_0/source/lib/util: .

Rafal Szczesniak mimir at
Wed Sep 20 15:31:06 GMT 2006

On Tue, Sep 19, 2006 at 10:14:44PM -0700, tridge at wrote:
> Mimir,
>  > a new function converting NTTIME to struct timeval
>  > +	tv->tv_usec = t - tv->tv_sec*1000000;
>  > +}
> Are you sure thats correct?

Well, just for a quick check I put a code, in one of my test, getting
current time in timeval, converting it to NTTIME, and converting it
to timeval back again. It did work correctly, though I didn't do any
random tests.

> Maybe it's equivalent somehow, but I
> suspect to get the tv_usec value will involve a modulo operation,
> something like:
>   tv->tv_usec = ((t+5) % 10000000) / 10;

The idea of doing it was based on nt_time_to_unix function.

> Maybe we need a LOCAL-TIME unit test for these time functions?
> Converting from timeval to NTTIME then back again for some random
> times might be a useful test (with appropriate 0.5usec tolerence
> levels).

Sure, I was also thinking about that. The only thing that stopped me
that time was "do we really need to test this ?", but it looks like
we do.

Rafal Szczesniak
Samba Team member

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url :

More information about the samba-technical mailing list