[#223105] ruby programming best practice — "Shannon Fang" <xrfang@...>

As a dynamic language, Ruby is much more flexible and easier than other

18 messages 2006/11/01

[#223126] variable pointer — "akbarhome" <akbarhome@...>

@c = "donal"

17 messages 2006/11/01

[#223211] file size revisit — python152@...

Hi, folks

17 messages 2006/11/02

[#223299] Just a question to throw out there... — "Skotty" <shyguyfrenzy@...>

Another noobrube question.

23 messages 2006/11/02

[#223398] Output not clear — "Learning Ruby" <learningruby@...>

I am a newbie to Ruby and the output of the following program is not clear

14 messages 2006/11/03

[#223425] Bytecode Compiler (#100) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

27 messages 2006/11/03

[#223458] REXML ... performance & memory usage ... — Jeff Wood <jeff@...>

Wow ... I am trying to use REXML to parse through an 8.8Mb xml file ...

14 messages 2006/11/03

[#223653] Book wanted: Metaprogramming in Ruby — Jay Levitt <jay+news@...>

Now that Hal, David B, Curt, and others have some spare time:

25 messages 2006/11/06

[#223736] REXML — "pdg" <pgattphoto@...>

Hi All,

22 messages 2006/11/06

[#223831] the name of Matz — Byung-Hee HWANG <bh@...>

Hello,

51 messages 2006/11/07
[#223839] Re: [OT] the name of Matz — Yukihiro Matsumoto <matz@...> 2006/11/07

Hi,

[#223975] Re: [OT] the name of Matz — Devin Mullins <twifkak@...> 2006/11/08

Yukihiro Matsumoto wrote:

[#224630] Re: the name of Matz — "Ryo" <furufuru@...> 2006/11/12

Yukihiro Matsumoto wrote:

[#224645] Re: the name of Matz — "Robert Dober" <robert.dober@...> 2006/11/12

On 11/12/06, Ryo <furufuru@ccsr.u-tokyo.ac.jp> wrote:

[#242731] Re: the name of Matz — Harry <ruby.hardware@...> 2007/03/09

> It might be fun though if you could give a pointer to the "correct"

[#224216] Re: [OT] the name of Matz — Byung-Hee HWANG <bh@...> 2006/11/09

Yukihiro Matsumoto wrote:

[#223846] How to make a cycling counter from commandline? — "darenbell@..." <darenbell@...>

Hi, I'm looking for a way to implement this idea:

12 messages 2006/11/07

[#223930] Two way communication with the command shell (IO.popen?) — James Smith <jmdjmsmith@...>

19 messages 2006/11/08
[#223943] Re: Two way communication with the command shell (IO.popen?) — ara.t.howard@... 2006/11/08

On Wed, 8 Nov 2006, James Smith wrote:

[#223997] Re: Two way communication with the command shell (IO.popen?) — James Smith <jmdjmsmith@...> 2006/11/08

unknown wrote:

[#224012] Re: Two way communication with the command shell (IO.popen?) — ara.t.howard@... 2006/11/08

On Wed, 8 Nov 2006, James Smith wrote:

[#224327] Re: Two way communication with the command shell (IO.popen?) — James Smith <jmdjmsmith@...> 2006/11/10

unknown wrote:

[#224690] Re: testing whether a process has completed.. — James Smith <jmdjmsmith@...> 2006/11/12

OK, keeping it simple I am basically using the following code:

[#224691] Re: testing whether a process has completed.. — "Patrick Hurley" <phurley@...> 2006/11/12

On 11/12/06, James Smith <jmdjmsmith@msn.com> wrote:

[#223953] Why create web servers? — "CatLady []" <totalharmonicdistortion@...>

Hi,

16 messages 2006/11/08

[#224002] FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled — Mauricio Fernandez <mfp@...>

FastRI 0.1.0: faster, smarter RI docs for Ruby, DRb-enabled

27 messages 2006/11/08

[#224013] #returning and #tap — "Trans" <transfire@...>

Had use for this today: #returning is a convenience method you'll find

57 messages 2006/11/08
[#225210] Re: #returning and #tap — Eric Hodel <drbrain@...7.net> 2006/11/15

On Nov 8, 2006, at 6:40 AM, Trans wrote:

[#225233] Re: #returning and #tap — Joel VanderWerf <vjoel@...> 2006/11/16

Eric Hodel wrote:

[#225358] Re: #returning and #tap — Eric Hodel <drbrain@...7.net> 2006/11/16

On Nov 15, 2006, at 5:40 PM, Joel VanderWerf wrote:

[#225370] Re: #returning and #tap — ara.t.howard@... 2006/11/16

On Fri, 17 Nov 2006, Eric Hodel wrote:

[#225382] Re: #returning and #tap — Joel VanderWerf <vjoel@...> 2006/11/16

ara.t.howard@noaa.gov wrote:

[#225385] Re: #returning and #tap — dblack@... 2006/11/16

Hi --

[#225388] Re: #returning and #tap — Joel VanderWerf <vjoel@...> 2006/11/16

dblack@wobblini.net wrote:

[#225393] Re: #returning and #tap — dblack@... 2006/11/16

Hi --

[#225399] Re: #returning and #tap — Joel VanderWerf <vjoel@...> 2006/11/16

dblack@wobblini.net wrote:

[#225420] Re: #returning and #tap — dblack@... 2006/11/16

Hi --

[#225476] Re: #returning and #tap — "Martin DeMello" <martindemello@...> 2006/11/17

On 11/17/06, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#225488] Re: #returning and #tap — dblack@... 2006/11/17

Hi --

[#225494] Re: #returning and #tap — spooq <spoooq@...> 2006/11/17

I definitely think of it as tapping a phone line.

[#225495] Re: #returning and #tap — spooq <spoooq@...> 2006/11/17

Actually, how about giving the proc a copy of the object, rather than

[#224039] Proc as Observer — "Tim Pease" <tim.pease@...>

Working with an Observable object, I wanted to be able to add a Proc

20 messages 2006/11/08
[#224061] Re: Proc as Observer — "Trans" <transfire@...> 2006/11/08

[#224040] Simple Math Problem — Thom Loring <tloring@...>

Can anyone shed some light on a simple math problem I have encountered?

14 messages 2006/11/08

[#224087] The Ruby Way review on Slashdot — Timothy Hunter <TimHunter@...>

Whoo-hoo! My review of Hal Fulton's _The_Ruby_Way,_Second_Edition_ is on

17 messages 2006/11/08

[#224157] thousand ways to rome — Chris Mueller <damngoodcoffee@...>

Hi,

17 messages 2006/11/09

[#224246] Overwriting the Integer class for method succ! (instead of just succ) — "paul" <pjvleeuwen@...>

Hi all,

11 messages 2006/11/09

[#224331] Rails vs. Asp.Net politics — "Leslie Viljoen" <leslieviljoen@...>

I have the deciding vote in a new (rather large) web app we need to

28 messages 2006/11/10

[#224352] VCR Program Manager (#101) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

13 messages 2006/11/10

[#224398] looking for some feedback about Certification — "pat eyler" <pat.eyler@...>

Aaah, nothing like a good controversial topic to stir up a holy war

38 messages 2006/11/10
[#224401] Re: looking for some feedback about Certification — Gustav Paul <gustav@...> 2006/11/10

pat eyler wrote:

[#224439] Re: looking for some feedback about Certification — dblack@... 2006/11/11

Hi --

[#224411] turn 0.1.0 Released — "Tim Pease" <tim.pease@...>

turn version 0.1.0 has been released!

18 messages 2006/11/10

[#224532] McGovern Likes JRuby... — Charles Oliver Nutter <charles.nutter@...>

I'm not sure how to feel about this one :)

26 messages 2006/11/11
[#224570] Re: McGovern Likes JRuby... — "M. Edward (Ed) Borasky" <znmeb@...> 2006/11/11

Charles Oliver Nutter wrote:

[#224574] Re: McGovern Likes JRuby... — David Vallner <david@...> 2006/11/11

M. Edward (Ed) Borasky wrote:

[#224539] Ruby GUI with IDE — "Josh Mr." <kamipride102@...>

Hello all,

33 messages 2006/11/11
[#224543] Re: Ruby GUI with IDE — "M. Edward (Ed) Borasky" <znmeb@...> 2006/11/11

Josh Mr. wrote:

[#224546] Re: Ruby GUI with IDE — AliasX Neo <kamipride102@...> 2006/11/11

M. Edward (Ed) Borasky wrote:

[#224554] Re: Ruby GUI with IDE — David Vallner <david@...> 2006/11/11

AliasX Neo wrote:

[#224569] Re: Ruby GUI with IDE — "M. Edward (Ed) Borasky" <znmeb@...> 2006/11/11

David Vallner wrote:

[#224577] Re: Ruby GUI with IDE — Caleb Tennis <caleb@...> 2006/11/11

>>

[#224578] Re: Ruby GUI with IDE — AliasX Neo <kamipride102@...> 2006/11/11

So I guess a better format for my original question should be:

[#224580] Re: Ruby GUI with IDE — David Vallner <david@...> 2006/11/11

AliasX Neo wrote:

[#224639] regular expression too big — Peter Schrammel <peter.schrammel@...>

Hi,

31 messages 2006/11/12

[#224665] Help convert a Perl user to the Ruby Way. — Sebastian Reid <seb@...>

Hi all.

13 messages 2006/11/12

[#224777] Nitro + Og 0.40.0 — "George Moschovitis" <george.moschovitis@...>

Hello everyone,

17 messages 2006/11/13

[#224817] directory_watcher 0.1.1 — "Tim Pease" <tim.pease@...>

A class for watching files within a directory and generating events

16 messages 2006/11/13
[#224838] Re: directory_watcher 0.1.1 — "Kenosis" <kenosis@...> 2006/11/13

[#224839] Re: directory_watcher 0.1.1 — "Tim Pease" <tim.pease@...> 2006/11/13

On 11/13/06, Kenosis <kenosis@gmail.com> wrote:

[#224933] ruby indentantion — Alfonso <euoar@...>

I have just started with ruby, and something that I have observed is

23 messages 2006/11/14

[#224949] Is 2.0 Integer or Float? — "S. Robert James" <srobertjames@...>

I'd like to be able to do:

18 messages 2006/11/14

[#224997] Assoc method on large array — "gregarican" <greg.kujawa@...>

I am trying to invoke the assoc method on a large array. It seems to

13 messages 2006/11/14

[#225069] Design problem with 'inject' — Gary Boone <dr@...>

20 messages 2006/11/15

[#225109] FastRI 0.2.0: full-text searching, smarter search strategies — Mauricio Fernandez <mfp@...>

FastRI is an alternative to the ri command-line tool. It is *much* faster, and

9 messages 2006/11/15

[#225179] *Fast* way to process large files line by line — Devesh Agrawal <dagrawal@...>

Hi Folks,

20 messages 2006/11/15

[#225288] Re: parse xml file, put results in mysql db — "seb@..." <seb@...>

--- Kathy Simmons <kathys39@hotmail.com> wrote:

15 messages 2006/11/16
[#225291] Re: parse xml file, put results in mysql db — Jon Egil Strand <jes@...> 2006/11/16

>

[#225296] Re: parse xml file, put results in mysql db — Mike Fletcher <lemurific+rforum@...> 2006/11/16

Jon Egil Strand wrote:

[#225330] Re: parse xml file, put results in mysql db — Kathy Simmons <kathys39@...> 2006/11/16

Here's the full code - I'm reading in nmap output in scanfile.xml and

[#225379] IHelp 0.4.0 - full text search — "Ilmari Heikkinen" <ilmari.heikkinen@...>

View and search object documentation from irb.

13 messages 2006/11/16
[#225383] Re: [ANN] IHelp 0.4.0 - full text search — Parragh Szabolcs <parragh@...> 2006/11/16

Ilmari Heikkinen 叝ta:

[#225398] Re: [ANN] IHelp 0.4.0 - full text search — "Ilmari Heikkinen" <ilmari.heikkinen@...> 2006/11/16

Hi,

[#225412] Re: [ANN] IHelp 0.4.0 - full text search — "Ilmari Heikkinen" <ilmari.heikkinen@...> 2006/11/16

> Thanks for noticing this, should be fixed in 0.4.1.

[#225470] Re: [ANN] IHelp 0.4.0 - full text search — Parragh Szabolcs <parragh@...> 2006/11/17

Ilmari Heikkinen 叝ta:

[#225512] Literate Ruby (#102) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

12 messages 2006/11/17

[#225547] ruby equivalent PHP function is_numeric? — Josselin <josselin@...>

After reading completely my Ruby book, I cannot find a function

15 messages 2006/11/17

[#225681] Ruby vs Java vs c++ — n/a <na@...>

hi, newbie so please be tolerant.... ;)

117 messages 2006/11/18

[#225754] Ruby screen scraping — Chris Gallagher <cgallagher@...>

Hi,

28 messages 2006/11/19

[#225909] Create array of hash values — David Lelong <drlelon@...>

Hi,

13 messages 2006/11/20

[#226023] Bug in ruby? — AliasX Neo <kamipride102@...>

Well, I've spent the last hour or so debugging one of the stupidest

31 messages 2006/11/21

[#226029] array question — Li Chen <chen_li3@...>

Hi all,

41 messages 2006/11/21
[#226031] Re: array question — "Wilson Bilkovich" <wilsonb@...> 2006/11/21

On 11/20/06, Li Chen <chen_li3@yahoo.com> wrote:

[#226120] Hpricot/Rubyful Soup comparison — Wes Gamble <weyus@...>

Has anyone done a head to head comparison of Hpricot and Rubyful Soup

19 messages 2006/11/21

[#226168] New RCRchive, including new process — dblack@...

Hi everyone --

35 messages 2006/11/22

[#226210] invoke system command from within a method — Moritz Reiter <mreiter@...>

-----BEGIN PGP SIGNED MESSAGE-----

11 messages 2006/11/22

[#226228] how do I contribute to Ruby? — "Giles Bowkett" <gilesb@...>

check this out, this is the whiniest change ever, but what I want is

15 messages 2006/11/22

[#226262] Rubyish inst.var initializations — "Victor \"Zverok\" Shepelev" <vshepelev@...>

Hi all.

12 messages 2006/11/23

[#226263] Compare Array Values? — "Daniel N" <has.sox@...>

I want to check to see if two arrays contain the same values.

30 messages 2006/11/23

[#226388] Anyone else getting weird flickr errors? — "Gregory Brown" <gregory.t.brown@...>

When I post to RubyTalk, I've been getting a 'your photo upload

14 messages 2006/11/24

[#226484] Is there a simply way to get every method log itself before running? — "Richard" <RichardDummyMailbox58407@...>

Hi,

11 messages 2006/11/24

[#226537] DictionaryMatcher (#103) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

18 messages 2006/11/24

[#226553] Ruby/Python/REXX as a MUCK scripting language — Tony Belding <zobeid@...>

I'm interested in using an off-the-shelf interpreted language as a

18 messages 2006/11/25

[#226608] coding practise — sempsteen <sempsteen@...>

Hi all,

23 messages 2006/11/25

[#226707] Ruby/Rails on Gumstix — "M. Edward (Ed) Borasky" <znmeb@...>

For the past couple of weeks, I've been playing around with Ruby on a

16 messages 2006/11/26
[#226751] Re: Ruby/Rails on Gumstix — "Giles Bowkett" <gilesb@...> 2006/11/26

On 11/25/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#226709] Timestamp — Srinivas Sa <sr.sakhamuri@...>

How do i add two time stamps

23 messages 2006/11/26

[#226731] find index of first non zeo value in array — Josselin <josselin@...>

with :

24 messages 2006/11/26
[#226733] Re: find index of first non zeo value in array — Olivier <o.renaud@...> 2006/11/26

Le dimanche 26 novembre 2006 15:00, Josselin a 馗rit

[#226783] Two Advanced Ruby Performance Questions — Sunny Hirai <sunny@...>

First, I am a Ruby newbie but am an experienced developer of highly

27 messages 2006/11/26
[#226816] Re: Two Advanced Ruby Performance Questions — Edwin Fine <efine145-nospam01@...> 2006/11/26

This post may be stating the obvious, but here goes anyway... I hope I

[#226792] Extremely Noobish Documentation Question — Paco Paco <mepaco@...>

Hello all,

16 messages 2006/11/26

[#226806] Re: ruby and list comprehension — James Cunningham <jameshcunningham@...>

On 2006-11-25 18:47:26 -0500, Brad Tilley <rtilley@vt.edu> said:

12 messages 2006/11/26

[#227012] Is ruby a viable corporate alternative? — "Mr P" <MisterPerl@...>

Our team uses Perl for almost 100% of our projects, as we have for the

27 messages 2006/11/28

[#227041] FileUtils.touch doesn't work — Jeff Toth <jeff@...>

Why won't Ruby just install from the port? I don't know what Ruby is,

12 messages 2006/11/28

[#227108] Simple screen scraper using scrAPI — "doog" <doog@...>

I'm a Ruby novice. Does anyone have an example of a simple screen

14 messages 2006/11/28

[#227160] cidr.rb: port of Perl's Net::CIDR v0.11 available — Jos Backus <jos@...>

Module:

17 messages 2006/11/29

[#227198] Splitting a CSV file into 40,000 line chunks — Drew Olson <olsonas@...>

All -

40 messages 2006/11/29
[#227243] Re: Splitting a CSV file into 40,000 line chunks — James Edward Gray II <james@...> 2006/11/29

On Nov 29, 2006, at 9:32 AM, Drew Olson wrote:

[#227255] Re: Splitting a CSV file into 40,000 line chunks — Drew Olson <olsonas@...> 2006/11/29

Thanks for all the responses. As noted in a post above, I am trying to

[#227219] Need a range, but not getting it. . . . — Peter Bailey <pbailey@...>

Hello,

33 messages 2006/11/29

[#227282] creating directory "http://example.com" — Comfort Eagle <steve@...>

How do I create a directory 'http://example.com' without it getting

16 messages 2006/11/29

[#227302] Wrong results using named arguments — "Jason Vogel" <jasonvogel@...>

Source:

12 messages 2006/11/29

[#227336] Overwhelmed by emails — Daniel DeLorme <dan-ml@...42.com>

This list has way too many messages for the amount of free time I have. Does

12 messages 2006/11/30

[#227388] Timers, scheduling and Ruby — Damphyr <damphyr@...>

Ok, since the original post migh just appear in a month's time, lets

24 messages 2006/11/30
[#227404] Re: Timers, scheduling and Ruby — James Edward Gray II <james@...> 2006/11/30

On Nov 30, 2006, at 7:51 AM, Damphyr wrote:

[#227414] Re: Timers, scheduling and Ruby — ara.t.howard@... 2006/11/30

On Fri, 1 Dec 2006, James Edward Gray II wrote:

[#227416] Re: Timers, scheduling and Ruby — James Edward Gray II <james@...> 2006/11/30

On Nov 30, 2006, at 11:47 AM, ara.t.howard@noaa.gov wrote:

[#227461] Re: Timers, scheduling and Ruby — ara.t.howard@... 2006/11/30

On Fri, 1 Dec 2006, James Edward Gray II wrote:

[#227402] Segmentation fault, proc, eval, long string — Bob Hutchison <hutch@...>

Hi,

27 messages 2006/11/30
[#227415] Re: Segmentation fault, proc, eval, long string [Reproduced] — Bob Hutchison <hutch@...> 2006/11/30

A little more on this...

[#227569] Re: Segmentation fault, proc, eval, long string [Reproduced] — Pit Capitain <pit@...> 2006/12/01

Bob Hutchison schrieb:

[#227426] simple question, looping through each character in a string — "warhero" <beingthexemplarylists@...>

how can I accomplish something like this in ruby:

17 messages 2006/11/30
[#227438] Re: simple question, looping through each character in a string — dblack@... 2006/11/30

Hi --

[#227458] Wisdom of including Rakefile in releases — "Trans" <transfire@...>

I was poking around in the /usr/lib/ruby/gems directory today and

13 messages 2006/11/30

Re: [QUIZ] Fuzzy Time (#99) - Results

From: "Gavin Kistner" <gavin.kistner@...>
Date: 2006-11-02 17:28:02 UTC
List: ruby-talk #223291
From: Gavin Kistner 
> Following are the results I obtained from running my test 
> script against everyone's submissions.

Oops. I found a small bug in my test script's counting of offsets.
(Large update intervals would cause it to think that the class was
transitioning outside of a +/- 5 minute range.)

Here are updated results and test script. Sorry for the bandwidth. :)

C:\Ruby\Quiz\FuzzyTime>testall.bat

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb BenGiddings_1.rb
Loaded suite BenGiddings_1
Started
F
Finished in 0.016 seconds.

  1) Failure:
test_running(FuzzyTimeTester)
    [./test_fuzzytime.rb:33:in `test_running'
     ./test_fuzzytime.rb:27:in `times'
     ./test_fuzzytime.rb:27:in `test_running'
     ./test_fuzzytime.rb:23:in `each'
     ./test_fuzzytime.rb:23:in `test_running']:
<Mon Nov 06 23:04:15 -0700 2006> expected but was
<Mon Nov 06 23:04:13 -0700 2006>.

1 tests, 3 assertions, 1 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb CameronPope_1.rb
Loaded suite CameronPope_1
Started
2 second advance: 0.0% behind, 38.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%   0%   0%  0.7%  0%   12%  41%  46%

6 second advance: 0.0% behind, 31.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%   0%  0.7% 4.8% 9.6%  25%  38%  22%

17 second advance: 1.8% behind, 19.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 0.7% 0.7% 2.7% 6.2%  11%  14%  19%  21%  18% 6.2%

30 second advance: 3.2% behind, 16.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
1.4% 2.1% 1.4% 3.4% 6.2%  19%  14%  18%  23% 9.0% 3.4%

47 second advance: 6.8% behind, 14.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
5.6% 3.5% 5.6% 5.6%  11%  13%  16%  15%  16% 5.6% 3.5%

60 second advance: 11.5% behind, 9.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 10% 7.6% 6.3%  11%  13%  15%  15%  12% 6.3% 4.2% 0.7%

65 second advance: 9.8% behind, 10.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 11% 4.8% 8.3%  10% 9.0%  18%  14%  14% 6.2% 3.4%  0%

120 second advance: 22.5% behind, 9.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 26%  20%  0%   17%  0%   17%  0%   15%  0%  4.9%  0%

290 second advance: 27.2% behind, 9.4% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 64%  10% 2.9% 5.0% 2.9% 6.5% 3.6% 2.2% 1.4% 1.4%  0%

.
Finished in 16.937 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb DamienPetrelli_1.rb
Loaded suite DamienPetrelli_1
Started
F
Finished in 0.016 seconds.

  1) Failure:
test_running(FuzzyTimeTester)
    [./test_fuzzytime.rb:33:in `test_running'
     ./test_fuzzytime.rb:27:in `times'
     ./test_fuzzytime.rb:27:in `test_running'
     ./test_fuzzytime.rb:23:in `each'
     ./test_fuzzytime.rb:23:in `test_running']:
<Mon Nov 13 12:19:40 -0700 2006> expected but was
<Sun Oct 22 09:22:42 -0600 2006>.

1 tests, 1 assertions, 1 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb DanielLucraft_1.rb
Loaded suite DanielLucraft_1
Started
2 second advance: 7.8% behind, 17.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  9.0% 7.6%  10%  11%  10%  12% 7.6% 4.2%  16%  12%

6 second advance: 7.3% behind, 16.0% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  11% 5.5%  15% 9.0%  12%  12% 9.7% 5.5%  13% 6.2%

17 second advance: 9.9% behind, 17.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  13%  16% 6.9% 7.6% 8.3% 6.2% 9.0%  14% 9.0% 9.7%

30 second advance: 9.9% behind, 15.0% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   12% 6.9%  15%  13% 8.3% 7.6%  10% 7.6%  10% 9.0%

47 second advance: 10.3% behind, 13.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  11%  14%  10%  12%  12%  10%  10% 5.5% 5.5% 8.3%

60 second advance: 8.1% behind, 15.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   12% 9.0%  10%  13%  12%  11% 8.3% 9.7% 6.2% 8.3%

65 second advance: 8.8% behind, 16.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  10%  14% 9.0%  10% 9.0%  10% 9.0% 9.0% 8.3%  10%

120 second advance: 6.1% behind, 20.4% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
8.4%  0%   17%  0%   22%  0%   19%  0%   20%  0%   13%

290 second advance: 7.4% behind, 18.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 14%  12% 6.5%  12%  11%  11% 7.9%  12% 6.5% 3.6% 4.3%

.
Finished in 28.344 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb GavinKistner_1.rb
Loaded suite GavinKistner_1
Started
2 second advance: 0.3% behind, 20.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%   0%   10%  20%  27%  19% 8.3%  15%

6 second advance: 0.9% behind, 24.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%  5.5% 6.8%  11%  25%  18%  12%  21%

17 second advance: 13.1% behind, 12.0% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
3.4%  12%  14% 7.6%  12%  12% 9.0% 9.0% 5.5% 9.0% 6.2%

30 second advance: 9.2% behind, 14.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
2.8% 6.3% 7.6%  15% 6.3% 9.0%  12%  15%  11% 8.3% 6.3%

47 second advance: 6.1% behind, 22.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
4.1% 6.9% 2.8% 5.5% 5.5% 9.0% 6.9% 9.7%  18%  19%  12%

60 second advance: 7.0% behind, 18.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
3.4% 9.0% 6.2% 4.8%  12% 9.7%  14% 9.7% 8.3%  12%  12%

65 second advance: 12.2% behind, 15.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
7.6%  11%  13% 6.9% 9.0% 8.3% 5.5%  12% 9.0%  11% 6.2%

120 second advance: 6.8% behind, 23.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 12%  0%   17%  0%   19%  0%   12%  0%   21%  0%   19%

290 second advance: 14.1% behind, 18.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 34% 5.5% 8.3% 5.5% 5.5% 9.0% 8.3% 6.2% 6.2% 4.8% 6.2%

.
Finished in 17.828 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb JeremyHinegardner_1.rb
Loaded suite JeremyHinegardner_1
Started
2 second advance: 0.0% behind, 43.0% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%  0.7%  0%   0%   0%   0%   0%  1.4%  22%  76%

6 second advance: 0.0% behind, 38.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%  0.7%  0%   0%   0%   0%  9.6%  46%  43%

17 second advance: 0.0% behind, 31.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 0.7%  0%   0%   0%  0.7% 2.1%  12%  36%  34%  15%

30 second advance: 0.4% behind, 25.0% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%  2.1% 6.2% 9.7%  22%  29%  23% 7.6%

47 second advance: 0.8% behind, 23.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%  2.1% 4.1% 8.2%  15%  21%  21%  18% 8.9%

60 second advance: 0.5% behind, 21.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%  1.4% 2.8%  17%  18%  15%  20%  19% 6.9%

65 second advance: 1.2% behind, 18.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%  0.7% 4.1% 8.3%  15%  18%  21%  19%  12% 2.1%

120 second advance: 6.1% behind, 11.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 5.6%  0%   20%  0%   30%  0%   33%  0%   11%  0%

290 second advance: 11.1% behind, 14.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 23%  11%  12%  11%  11% 5.0% 9.9% 7.1% 4.3% 3.5% 1.4%

.
Finished in 19.016 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb MarcelWard_1.rb
Loaded suite MarcelWard_1
Started
2 second advance: 5.9% behind, 15.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 2.8% 4.1% 9.7%  11%  12%  15%  12%  11%  10%  10%

6 second advance: 6.7% behind, 15.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 3.4% 4.1%  10%  12% 8.2%  13%  17%  12%  10% 8.9%

17 second advance: 7.1% behind, 15.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  2.8% 6.9%  13%  13%  12% 7.6%  11%  13%  13% 7.6%

30 second advance: 8.1% behind, 15.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  7.6% 6.2%  13% 4.1%  14%  10%  12%  12% 9.0%  11%

47 second advance: 6.8% behind, 17.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
2.7% 4.1% 4.8%  12%  12%  11% 6.2%  14%  10%  14% 8.9%

60 second advance: 9.7% behind, 13.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
3.4% 9.7% 9.7% 9.7% 6.9%  12%  13%  12%  12% 7.6% 2.8%

65 second advance: 6.4% behind, 16.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
1.4% 5.5% 6.9% 9.7% 8.3%  15%  12%  10%  12%  12% 6.9%

120 second advance: 6.0% behind, 17.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
9.0%  0%   17%  0%   24%  0%   22%  0%   24%  0%  4.2%

290 second advance: 8.4% behind, 14.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 19%  12% 9.3%  14%  10%  11% 9.3% 7.1% 4.3% 3.6% 1.4%

.
Finished in 22.282 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb PaoloNegri_1.rb
Loaded suite PaoloNegri_1
Started
2 second advance: 8.3% behind, 10.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 2.7% 9.6%  14%  10%  14%  16%  14%  12% 4.8% 2.1%

6 second advance: 8.0% behind, 11.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  2.1% 8.3% 9.0%  16%  16%  12%  12%  12% 8.3% 4.9%

17 second advance: 7.4% behind, 11.4% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  5.5% 4.8% 9.0%  17%  10%  21% 9.0%  12% 9.7% 1.4%

30 second advance: 7.5% behind, 11.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 4.8% 8.3% 9.0%  19%  16%  14% 9.0% 5.5%  11% 2.1%

47 second advance: 8.3% behind, 10.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 6.9% 8.3%  12%  18%  11%  15%  12% 9.0% 4.1% 2.1%

60 second advance: 7.2% behind, 11.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 3.4%  12% 9.7%  17%  14%  14%  13%  10% 4.8% 1.4%

65 second advance: 6.8% behind, 13.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
2.1% 5.6% 7.6%  12%  15%  12%  16%  13%  10% 5.6% 2.1%

120 second advance: 9.4% behind, 11.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 13%  0%   28%  0%   22%  0%   25%  0%   12%  0%   0%

290 second advance: 9.1% behind, 12.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 22%  12%  11%  12% 9.7%  12% 7.6% 6.2% 2.8% 3.4% 1.4%

.
Finished in 18.89 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb RobertConn_1.rb
Loaded suite RobertConn_1
Started
2 second advance: 0.0% behind, 49.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  0.7%  0%   0%   0%   0%   0%   0%   0%   0%   99%

6 second advance: 0.0% behind, 48.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%  0.7%  0%   0%   0%   0%   0%   0%   0%   99%

17 second advance: 0.0% behind, 46.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%   0%   0%  0.7%  0%  1.4% 9.0%  89%

30 second advance: 0.0% behind, 44.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%   0%   0%  0.7%  0%  5.6%  19%  74%

47 second advance: 0.0% behind, 41.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%   0%  0.7% 2.1% 2.1%  13%  31%  50%

60 second advance: 0.2% behind, 38.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%  0.7% 0.7% 4.1% 2.8%  10%  13%  20%  48%

65 second advance: 0.3% behind, 40.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%  1.4% 1.4% 1.4% 2.1% 5.6%  14%  28%  47%

120 second advance: 1.9% behind, 25.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
2.1% 2.8%  0%  2.8%  0%   16%  0%   30%  0%   46%  0%

290 second advance: 10.1% behind, 27.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 13% 5.5% 2.4% 3.1% 8.7% 7.9%  13%  15%  10%  11%  10%

.
Finished in 17.453 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb ThomasMueller_1.rb
Loaded suite ThomasMueller_1
Started
2 second advance: 0.0% behind, 43.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%   0%   0%   0%   0%   0%   15%  85%

6 second advance: 0.0% behind, 37.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  0.7%  0%   0%   0%   0%   0%  0.7%  14%  48%  36%

17 second advance: 0.0% behind, 32.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%   0%  0.7% 2.1%  14%  26%  41%  17%

30 second advance: 0.4% behind, 26.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%  1.4% 2.1% 2.8%  12%  18%  28%  22%  13%

47 second advance: 0.8% behind, 23.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%  0.7% 1.4% 3.5% 9.0%  17%  21%  17%  21% 9.7%

60 second advance: 2.1% behind, 17.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  0.7% 1.4% 4.8%  10%  15%  16%  13%  27% 9.0% 2.8%

65 second advance: 1.2% behind, 19.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  0.7%  0%  2.1%  11%  12%  21%  17%  19%  16% 2.1%

120 second advance: 3.9% behind, 14.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  3.4%  0%   16%  0%   30%  0%   34%  0%   17%  0%

290 second advance: 5.7% behind, 14.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 11%  11%  11%  14%  13%  12% 9.2% 8.5% 3.5% 2.1% 3.5%

.
Finished in 17.234 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb TomPollard_1.rb
Loaded suite TomPollard_1
Started
2 second advance: 0.0% behind, 46.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%   0%   0%   0%   0%  0.7% 4.8%  94%

6 second advance: 0.0% behind, 42.8% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  0.7%  0%   0%   0%   0%   0%   0%  5.5%  32%  62%

17 second advance: 0.0% behind, 33.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%  0.7% 0.7% 3.4% 8.3%  26%  33%  28%

30 second advance: 0.1% behind, 31.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7%  0%   0%   0%  0.7%  0%  5.5%  16%  29%  28%  21%

47 second advance: 0.8% behind, 23.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%  2.1% 2.1% 9.7%  14%  21%  25%  14%  12%

60 second advance: 1.3% behind, 23.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 0.7% 0.7% 3.4% 4.8% 7.6%  19%  17%  14%  23% 8.3%

65 second advance: 1.1% behind, 22.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%  0.7% 2.1% 9.0% 9.0%  17%  20%  17%  18% 7.6%

120 second advance: 5.7% behind, 13.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 8.3%  0%   18%  0%   28%  0%   30%  0%   15%  0%

290 second advance: 8.7% behind, 15.1% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 17%  12%  13% 9.5%  10% 9.5% 8.0% 8.0% 6.6% 5.8% 0.7%

.
Finished in 17.859 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors

C:\Ruby\Quiz\FuzzyTime>ruby -rtest_fuzzytime.rb TomPollard_2.rb
Loaded suite TomPollard_2
Started
2 second advance: 0.0% behind, 49.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%  0.7%  0%   0%   0%   0%   0%   0%   99%

6 second advance: 0.0% behind, 48.9% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%   0%   0%   0%  0.7%  0%   0%   0%   0%  2.1%  97%

17 second advance: 0.0% behind, 45.5% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 0%  0.7%  0%   0%   0%   0%   0%  0.7% 5.5%  17%  77%

30 second advance: 0.8% behind, 38.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
0.7% 0.7% 2.1%  0%  0.7% 1.4% 3.4% 3.4%  16%  26%  46%

47 second advance: 5.9% behind, 23.2% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
2.8% 3.4% 6.9% 4.8% 9.7%  12% 5.5% 7.6%  12%  15%  21%

60 second advance: 12.9% behind, 13.3% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 10%  11%  11% 9.0% 9.0% 9.0%  10% 9.0% 9.7% 7.6% 4.1%

65 second advance: 16.8% behind, 14.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 23%  10% 7.5% 9.6% 9.6% 4.8% 4.8% 8.2% 7.5% 8.2% 6.8%

120 second advance: 9.2% behind, 18.6% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
4.9%  13%  0%   13%  0%   10%  0%   32%  0%   27%  0%

290 second advance: 29.9% behind, 8.7% ahead
 -5   -4   -3   -2   -1    0   +1   +2   +3   +4   +5
 72% 9.0% 3.5% 4.9% 3.5% 2.1% 4.2% 1.4%  0%   0%   0%

.
Finished in 19.25 seconds.

1 tests, 142380 assertions, 0 failures, 0 errors


====
Updated test script
====

require 'test/unit'

$DEBUG = false

class Time
  def to_fuzzy
    s = strftime("%H:%M")
    s[4] = "~"
    s
  end
  def short
    strftime("%H:%M")
  end
  def round_to( seconds )
    seconds = seconds.round
    Time.at( self.to_i / seconds * seconds )
  end
end

RUNS_PER_SET = 1
class FuzzyTimeTester < Test::Unit::TestCase
  def test_running
    [ 2, 6, 17, 30, 47, 60, 65, 120, 290 ].each{ |advance_seconds|
      runs, num_ahead, num_behind = 0, 0, 0
      offsets = Hash.new(0)
      
      RUNS_PER_SET.times{
        t = Time.at( Time.new + rand( 3600 * 300 ) )
        end_time = t + 60 * 60 * 24 # Run for 24 hours
        ft = FuzzyTime.new( t )
        last_value = nil
        while( t < end_time )
          assert_equal t, ft.actual
          t0 = Time.at( t - 60 * 5 )
          t2 = Time.at( t + 60 * 5 )
          legal_values = [ t0, t, t2 ].map{ |x| x.to_fuzzy }.uniq

          fuzzy_fuzz = ft.to_s      

          if last_value
            y,mon,day = t.year, t.mon, t.day
            h,m = last_value.scan(/\d+/).map{ |s| s.to_i }
            m *= 10
            if (m -= 10) < 0
              m %= 60
              if (h -= 1) < 0
                h %= 24
              end
            end
            illegal_old_value = Time.local( y,mon,day,h,m ).to_fuzzy
            legal_values -= [ illegal_old_value ]
            if $DEBUG
              puts "Now: %s=>%s; legal: %s (was %s, can't be %s)" % [
                t.short, fuzzy_fuzz,
                legal_values.inspect, last_value,
                illegal_old_value
              ]
            end
          end
  
          assert_block( ( "It is %s, the clock displayed %s,\n" +
                        "but it should only display one of %s.\n" +
                        "(Last time I asked, it said it was %s.)" ) % [
            t.short, fuzzy_fuzz.inspect,
            legal_values.inspect,
            last_value
          ] ){
            legal_values.include?( fuzzy_fuzz )
          }
    
          actual_fuzz = t.to_fuzzy
          ahour, amin = actual_fuzz.scan( /\d+/ ).map{ |x| x.to_i }
          fhour, fmin = fuzzy_fuzz.scan( /\d+/ ).map{ |x| x.to_i }
          if fuzzy_fuzz != actual_fuzz
            if fmin>amin || fhour>ahour || ( fhour==0 && ahour==23 )
              num_ahead += 1
            else
              num_behind +=1
            end
          end
        
          if fuzzy_fuzz != last_value
            ahour2, amin2 = t.short.scan( /\d+/ ).map{ |x| x.to_i }
            if fmin>amin || fhour>ahour || ( fhour==0 && ahour==23 )
              offset = ( fmin*10 - amin2 ) % 60
            else
              offset = ( fmin*10 - amin2 )
            end
            offset = [-5, [ 5, offset ].min ].max
            offsets[ offset ] += 1
            if $DEBUG
              puts ( "It is %s, I just switched from %s to %s, " + 
                     "and I think that's an offset of %+d" ) % [
                t.short, last_value, fuzzy_fuzz, offset
              ]
            end
          end
          runs += 1      
          last_value = fuzzy_fuzz
          ft.advance( advance_seconds )
          t += advance_seconds
        end
      }
      
      puts "%d second advance: %.1f%% behind, %.1f%% ahead" % [
        advance_seconds,
        100.0 * num_behind / runs,
        100.0 * num_ahead / runs
      ]
      total_offsets = offsets.inject(0){ |sum,kv| sum+kv[1] }
      -5.upto(5){ |o|
        print "#{o>0?'+':''}#{o}".center( 5 )
      }; print "\n"
      -5.upto(5){ |o|
        pct = 100.0 * offsets[o] / total_offsets
        print( ( "%.#{(pct<10&&pct>0)?1:0}f%" % pct ).center( 5 ) )
      }; puts "\n "
    }
  end
end




In This Thread

Prev Next