--Apple-Mail-18--275850680
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

On 18 Mar 2005, at 01:50, Takaaki Tateishi wrote:

> Eric Hodel wrote:
>>   def self.c_localtime(clock)
>>     tm  IBC.localtime(clock)
>>     return tm.to_a('IIIIIIIIILc') # should match StructTm above
>>   end
>
> Please use StructTm to create a proxy as follows.
>
>    return LIBC::StructTm.new(tm)
>
> Now you can access each member as follows.
>
>   p [tm.tm_sec, tm.tm_min, tm.tm_hour,
>       tm.tm_mday, tm.tm_mon, tm.tm_year,
>       tm.tm_wday, tm.tm_yday, tm.tm_isdst,
>       tm.tm_gmtoff, tm.tm_zone]

Works perfect!

I changed DL::Importable::Internal::Memory like so to give more 
sensible output:

class DL::Importable::Internal::Memory

   def inspect
     i  "
     i << "#<#{self.class}:0x#{self.object_id.to_s(16)} "
     data  ]
     @names.each do |name|
       data << "#{name}self.send(name).inspect}"
     end
     i << data.join(', ')
     i << ">"
     return i
   end

end

So now I get this:

p Time.at(1_111_111_111).to_a
p LIBC.c_localtime(1_111_111_111)

[31, 58, 17, 17, 3, 2005, 4, 76, false, "PST"]
#<DL::Importable::Internal::Memory:0x89a1c tm_sec1, tm_minX, 
tm_hour, tm_mday, tm_mon  tm_year5, tm_wday@ tm_ydayu, 
tm_isdst tm_gmtoff8800, tm_zoneDL::PtrData:0x0x42f9f0 
ptr0x1808550 sizefree0x0>>

Note that Time#to_a returns some 1-based fields, while localtime uses 
0-based fields

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

--Apple-Mail-18--275850680
content-type: application/pgp-signature; x-mac-type=70674453;
	nameP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCOzCnMypVHHlsnwQRAhsXAKDS/9YehLdu5j97uIh3iUN8qBV9ZQCgj2Pt
4HkfCt3HriseCT05hMf1GVUHN
-----END PGP SIGNATURE-----

--Apple-Mail-18--275850680--