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

Allan McRae allan at archlinux.org
Fri Dec 6 21:13:43 EST 2013


On 07/12/13 11:36, Andrew Gregory wrote:
> 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.
> 

Darwin is a second class citizen - look at all the things in makepkg
that require ELF binaries.  As long as it builds and has basic
functionality, that is enough.

Have OSX use the current system, uses clock_gettime for the rest (I
believe the BSDs/Hurd all have it).

Allan



More information about the pacman-dev mailing list