# Re: Fuzzy Time (#99) - Results

**URL:** <https://www.ruby-forum.com/t/re-fuzzy-time-99-results/74762>\
**Category:** Ruby\
**Created:** [November 7, 2006, 10:55am UTC](https://www.ruby-forum.com/t/re-fuzzy-time-99-results/74762 "2006-11-07T10:55:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [November 7, 2006, 10:55am UTC](https://www.ruby-forum.com/t/re-fuzzy-time-99-results/74762/1 "2006-11-07T10:55:24Z")

</div>

From: Gavin K.

> 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
