From: Reinhard Meyer Date: Wed, 29 Jun 2011 07:06:16 +0200 Subject: [U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/ In-Reply-To: References: <1309261269-4363-1-git-send-email-graeme.russ@gmail.com> <1309261269-4363-10-git-send-email-graeme.russ@gmail.com> Message-ID: <4E0AB2C8.9010703@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear All, > Well I know i have asked this before, but I feel I should ask again > because I didn't like the answer much. > > Imagine we change this code to: > > ts = time_now_ms() + msec > do { > ... > } while (time_since_ms(ts)< 0); > > That should be legal, right? But I don't think this can work since the > 'since' functions return an unsigned. > > [aside: this provides for another idiom that I think we talked about: > > ts = time_future_ms(msec) > do { > ... > } while (!time_passed(ts)) > > which I am not at all suggesting should be in the API :-) > end aside] I still vouch for this concept, which is simple, clean, and easy to understand. Reinhard