Module: RhnSatellite::Common::Misc

Defined in:
lib/rhn_satellite/common/misc.rb

Class Method Summary collapse

Class Method Details

.gen_date_time(time = 'now') ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rhn_satellite/common/misc.rb', line 4

def gen_date_time(time='now')
  if time == 'now'
    t = Time.now
  elsif time.is_a?(DateTime) || time.is_a?(Time)
    t = time
  else
    return time
  end
  XMLRPC::DateTime.new(
    t.year,
    t.month,
    t.day,
    t.hour,
    t.min,
    t.sec
  )
end