From: Alfonso Caponi Date: 2009-12-28T22:57:14+09:00 Subject: Re: unpack :( Alfonso Caponi wrote: >>>> systemdate.unpack("nccccc") >> => [2009, 12, 28, 11, 42, 40] >> >> I'm not sure how you want the last 4 bytes interpreted, but a bit of >> googling for SNMP systemDate suggests the following: >> >>>> systemdate.unpack("nccccccAcc") >> => [2009, 12, 28, 11, 42, 40, 0, "+", 1, 0] >> >> i.e. 11:42:40.0 (tenths of a second) with a timezone of +01:00 > > Great! It's very good for my script! Thank you very much! :) dtm = systemDate.unpack("ncccccc") dtm =~ /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ systemDate = "#{dtm[0]}-#{dtm[1]}-#{dtm[2]} #{dtm[3]}:#{dtm[4]}:#{dtm[5]}" Is it obscene? :) -- Posted via http://www.ruby-forum.com/.