On 15 April 2013 12:14, Henrik Johansen <henrik.s.johan...@veloxit.no> wrote: > > On Apr 13, 2013, at 12:16 AM, Igor Stasenko wrote: > >> >> But that's fine.. now look at >> >> secondsWhenClockTicks >> >> "waits for the moment when a new second begins" >> >> | lastSecond | >> >> lastSecond := self primSecondsClock. >> [ lastSecond = self primSecondsClock ] whileTrue: [ (Delay >> forMilliseconds: 1) wait ]. >> >> ^ lastSecond + 1 >> >> that is complete nonsense. Sorry. >> >> This code relying on primSecondsClock resolution, which is..... (drum >> roll..... ) >> 1 second.. >> >> then it is combined with millisecondClockValue , as you see later to get >> system time with millisecond precision.. >> >> I am not genius in math and physics.. but even i understand that if >> you measurement has error X >> you cannot get more precision than X, even if you combine it with >> another measurement with higher precision. >> >> (But i can be wrong with that.. if so, please explain why) > > Because, as Levente said in code, resolution != accuracy. > When you measure a single sample, sure, that value has an error of max > resolution / 2. > But when you measure when that value _changes_, you have an error of the > underlying accuracy / 2. > Clock s value: 1 2 > resolution: |_______|_______| > accuracy: ||||||||||||||||||||||||||||||||||| > ^ > Here's to hoping the above ascii art(?) worked! > > So no, that method is not complete nonsense. > Okay. Now i rewriting the code which uses new primitive (primUTCMicrosecondClock), and then we will no longer need this startup logic nor wrap around check & other gory details... just use a primitive.
> Cheers, > Henry -- Best regards, Igor Stasenko.