aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/mauve_time.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-09-16 13:20:37 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-09-16 13:20:37 +0100
commit95be8df00c41a50ab705b462c656beb2bc2996e9 (patch)
treea0535a582cc30e695f68d4543202181da67a57bd /lib/mauve/mauve_time.rb
parent76ce90887a16c466eb54e76f84794b8469a14692 (diff)
Robustificate the XMPP ack interface.
Diffstat (limited to 'lib/mauve/mauve_time.rb')
-rw-r--r--lib/mauve/mauve_time.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/mauve/mauve_time.rb b/lib/mauve/mauve_time.rb
index d2949d9..f564fdb 100644
--- a/lib/mauve/mauve_time.rb
+++ b/lib/mauve/mauve_time.rb
@@ -34,11 +34,15 @@ class Time
# @return [Time]
#
def in_x_hours(n, type="wallclock")
+ raise ArgumentError, "n must be numeric" unless n.is_a?(Numeric)
+ raise ArgumentError, "type must be a string" unless type.is_a?(String)
+
t = self.dup
+
#
# Do this in seconds rather than hours
#
- n = n.to_i*3600
+ n = (n*3600).to_i
test = case type
when "working"