public
Rubygem
Description: JSON Web App Framework
Homepage: http://halcyon.rubyforge.org/
Clone URL: git://github.com/mtodd/halcyon.git
Click here to lend your support to: halcyon and make a donation at www.pledgie.com !
Added tests for Windows and Linux platforms and a bug fix for Windows not 
updating the microtimestamp but every 10 milliseconds, causing domain errors and 
division by zero. [#46 state:resolved]
mtodd (author)
Tue Jun 10 12:38:29 -0700 2008
commit  5d7a5a2c1e00c8f8e235c09d4fcb610e2fec3c76
tree    03c011689bfbde3ebbea9d4fe063f7115cd4b5d0
parent  05fc53e62fbe7f28b1c2e4f8276cc108e5052b31
...
14
15
16
17
 
18
19
20
...
54
55
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
58
59
...
14
15
16
 
17
18
19
20
...
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
0
@@ -14,7 +14,7 @@ $:.unshift File.dirname(__FILE__)
0
 #   Halcyon.version #=> "0.5.0"
0
 module Halcyon
0
   
0
-  VERSION = [0,5,0] unless defined?(Halcyon::VERSION)
0
+  VERSION = [0,5,1] unless defined?(Halcyon::VERSION)
0
   
0
   autoload :Application, 'halcyon/application'
0
   autoload :Client, 'halcyon/client'
0
@@ -54,6 +54,23 @@ module Halcyon
0
     end
0
     alias_method :configurable_attr, :configurable
0
     
0
+    # Tests for Windows platform (to compensate for numerous Windows-specific
0
+    # bugs and oddities.)
0
+    # 
0
+    # Returns Boolean:is_windows
0
+    # 
0
+    def windows?
0
+      RUBY_PLATFORM =~ /mswin/
0
+    end
0
+    
0
+    # Tests for Linux platform.
0
+    # 
0
+    # Returns Boolean:is_linux
0
+    # 
0
+    def linux?
0
+      RUBY_PLATFORM =~ /linux/
0
+    end
0
+    
0
   end
0
   
0
   # Creates <tt>Halcyon.db</tt> to alias <tt>Halcyon.config[:db]</tt>.
...
95
96
97
 
 
 
 
 
 
98
99
100
...
95
96
97
98
99
100
101
102
103
104
105
106
0
@@ -95,6 +95,12 @@ module Halcyon
0
       response.status = result[:status]
0
       response.write result.to_json
0
       
0
+      # There's a weird bug with Windows that usec is only updated every 10
0
+      # millisecs. This slows things down, but hopefully nobody is deploying to
0
+      # Windows platforms. This works because it updates the usec time at least
0
+      # once to prevent division-by-zero and domain errors.
0
+      sleep 0.01 if Halcyon.windows?
0
+      
0
       timing[:finished] = Time.now
0
       timing[:total] = (((timing[:finished] - timing[:started])*1e4).round.to_f/1e4)
0
       timing[:per_sec] = (((1.0/(timing[:total]))*1e2).round.to_f/1e2)

Comments