lib/ruote/util/time.rb in ruote-2.1.11 vs lib/ruote/util/time.rb in ruote-2.2.0
- old
+ new
@@ -1,7 +1,7 @@
#--
-# Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
+# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -43,11 +43,11 @@
# Produces the UTC string representation of a Time
#
# like "2009/11/23 11:11:50.947109 UTC"
#
- def self.time_to_utc_s (t)
+ def self.time_to_utc_s(t)
"#{t.utc.strftime('%Y-%m-%d %H:%M:%S')}.#{sprintf('%06d', t.usec)} UTC"
end
# Returns a parsable representation of the UTC time now.
@@ -61,11 +61,11 @@
# Turns a date or a duration to a Time object pointing AT a point in time...
#
# (my prose is weak)
#
- def self.s_to_at (s)
+ def self.s_to_at(s)
at = if s.index(' ')
#
# date
@@ -85,10 +85,10 @@
end
end
# Waiting for a better implementation of it in rufus-scheduler 2.0.4
#
- def self.is_cron_string (s)
+ def self.is_cron_string(s)
ss = s.split(' ')
return false if ss.size < 5 || ss.size > 6
return false if s.match(/\d{4}/)