From: Ned Konz Date: 2001-11-17T03:28:04+09:00 Subject: [ruby-talk:25565] Re: [newbie] Time.now into 4 bytes On Friday 16 November 2001 08:25 am, mrp@cre.canon.co.uk wrote: > i would like to grab the current time into 4 bytes in an array. > trying lots of variations of: > Time.now.to_i.to_s.unpack() > but i'm getting nowhere. > > i can do this by hand (bitmasks and shifts) but can anyone > tell me a rubyer way of doing this ? This seems to work (LS byte first): [ Time.now.to_i ].pack('V').unpack('C4') -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com