lib/openwfe/util/otime.rb in openwferu-0.9.12 vs lib/openwfe/util/otime.rb in openwferu-0.9.12.863

- old
+ new

@@ -49,11 +49,12 @@ # # Returns the current time as an ISO date string # def OpenWFE.now () - return to_iso8601_date(Time.new()) + + to_iso8601_date(Time.new()) end def OpenWFE.to_iso8601_date (date) if date.kind_of? Float @@ -65,11 +66,11 @@ end s = date.to_s # this is costly s[10] = " " - return s + s end # # the old method we used to generate our ISO datetime strings # @@ -87,11 +88,11 @@ # # Returns a Ruby time # def OpenWFE.to_ruby_time (iso_date) - return DateTime.parse(iso_date) + DateTime.parse(iso_date) end #def OpenWFE.parse_date (date) #end @@ -100,11 +101,11 @@ # def OpenWFE.current_time_millis () t = Time.new() t = t.to_f * 1000 - return t.to_i + t.to_i end # # turns a string like '1m10s' into a float like '70.0' # @@ -152,20 +153,20 @@ if not multiplier result = result + (value * multiplier) end - return result + result end # # returns true if the character c is a digit # def OpenWFE.is_digit? (c) return false if not c.kind_of?(String) return false if c.length > 1 - return (c >= "0" and c <= "9") + (c >= "0" and c <= "9") end # # conversion methods between Date[Time] and Time @@ -183,11 +184,11 @@ s = time.sec + Rational(time.usec, 10**6) o = Rational(time.utc_offset, 3600 * 24) begin - return DateTime.new( + DateTime.new( time.year, time.month, time.day, time.hour, time.min, @@ -202,11 +203,11 @@ #puts \ # "\n Date.new() problem. Params :"+ # "\n....y:#{time.year} M:#{time.month} d:#{time.day} "+ # "h:#{time.hour} m:#{time.min} s:#{s} o:#{o}" - return DateTime.new( + DateTime.new( time.year, time.month, time.day, time.hour, time.min, @@ -221,10 +222,10 @@ def OpenWFE.to_local_time (dtime) to_ttime(dtime.new_offset(DateTime.now.offset-offset), :local) end - def to_ttime (d, method) + def OpenWFE.to_ttime (d, method) usec = (d.sec_fraction * 3600 * 24 * (10**6)).to_i Time.send(method, d.year, d.month, d.day, d.hour, d.min, d.sec, usec) end protected