[PATCH] use montonic clock instead of gettimeofday

Thiago Macieira thiago at kde.org
Tue Dec 15 01:36:43 PST 2009


Em Terça-feira 15 Dezembro 2009, às 09:55:51, Joerg Barfurth escreveu:
> Tom Hughes schrieb:
> > Greetings,
> 
> Greetings. Just noticed this patch.
> 
> > Attached is a patch to use the monotonic clock instead of gettimeofday()
> > in _dbus_get_current_time(), which prevents issues when
> > _dbus_get_current_time() is used to calculate timeouts and the system
> > time changes (e.g., in _dbus_connection_block_pending_call()).
> 
> IMHO you should update the documentation for _dbus_get_current_time or,
> even better, rename it to reflect the new semantics. It does not return
> 'current' time as in gettimeofday any more, because the meaning of
> absolute time  values is now unspecified.
> 
> If this function is used in DBus for anything other than elapsed time or
> timeout calculations, the old version would need to be kept as well.

The bug report for this issue is Bug 25624.

> > It also contains a patch for pthread_cond_timedwait to use the monotonic
> > clock, but this appears to have already been fixed, so you can ignore
> > that part of the patch.
> 
> That part of the patch certainly looks broken. The
> pthread_condattr_setclock() would need to come after
> pthread_condattr_init().
> 
> And further below the new end_time.tv_nsec calculation is completely off
> (by 3 to 6 orders of magnitude).

Apparently that part of the patch was already applied in current 1.3 codebase. 
Can you check there if it looks ok?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20091215/f486ad8d/attachment.pgp 


More information about the dbus mailing list