[pacman-dev] [PATCH] handle time changes during progress display

Andrew Gregory andrew.gregory.8 at gmail.com
Fri Dec 6 20:36:44 EST 2013

On 12/07/13 at 10:13am, Martin Panter wrote:
> On 7 December 2013 05:32, Andrew Gregory <andrew.gregory.8 at gmail.com> wrote:
> > Previously, if the system time was adjusted backwards during a progress
> > display, get_update_timediff return negative values prevent the progress
> > bar from updating.  Instead, on negative values, the saved time is
> > reset.  Additionally, the download callback ignores the amount
> > downloaded to avoid skewing the rate.
> Have you considered using clock_gettime(CLOCK_MONOTONIC) rather than
> gettimeofday()? Or is it not available on some platforms? Even if you
> have to use a different function for OS X or something it mightn’t be
> much worse than these backwards time hacks.

Dave also pointed this out to me on IRC.  Unfortunately, it looks like
it is indeed not available on OS X.  If there is a suitable
replacement function on OS X we could go the platform-specific route,
otherwise it hardly seems worth it as we'd just end up having to do
all of the same hacks in the OS X branch.  It looks like OS X has
clock_get_time, but I'm having trouble finding proper documentation
for it to determine if it's suitable.


More information about the pacman-dev mailing list