From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 7186 invoked from network); 19 May 1999 09:56:08 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 19 May 1999 09:56:08 -0000 Received: from mail13.digital.com (mail13.digital.com [192.208.46.30]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id FAA17873 for ; Wed, 19 May 1999 05:17:18 -0400 Received: from reohub2.reo.dec.com (reohub2.reo.dec.com [16.37.21.19]) by mail13.digital.com (8.9.2/8.9.2/WV2.0g) with ESMTP id EAA05061 for ; Wed, 19 May 1999 04:57:20 -0400 (EDT) Received: by reohub2.reo.dec.com with Internet Mail Service (5.5.2559.0) id ; Wed, 19 May 1999 09:57:18 +0100 Message-ID: <15AD5D7936F8D21198240000F831776E3E7908@dboexc1.dbo.dec.com> From: Paul Jakma To: "'axp-list@redhat.com'" Subject: RE: Converting time (since 01-01-1970) to Epoch Date: Wed, 19 May 1999 09:57:10 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2559.0) Content-Type: text/plain > Perfect, here is the details: > > I have a binary file with record fixed lenght, it has been written on an > SGI > box (Irix 6.2) using the following structure: > > (/usr/include/rpcsvc/rusers.h) > > struct rusers_utmp { > char ut_line[8]; /* tty name */ > char ut_name[8]; /* user id */ > char ut_host[16]; /* host name, if remote */ > long ut_time; /* time on */ > }; > > For the SGI box, sizeof(long) = 4. > > > So I've converted the file, rewriting all the records on an Alpha-Linux > box > (kernel 2.2.7) using the following structure: > > (/usr/include/rpcsvc/rusers.h) > > struct ru_utmp { > char ut_line[8]; /* tty name */ > char ut_name[8]; /* user id */ > char ut_host[16]; /* host name, if remote */ > long ut_time; /* time on */ > }; > > For Alpha-Linux box, sizeof(long) = 8. > My conversion program does only a field's level assignments, and rewrites > the > new file, due to different sizeof(long). > The resulting dates (ut_time in ru_utmp) are all garbled. > Any ideas ? > how are you reading/parsing the input file? are you literally applying the ru_utmp structure to the sgi binary file? or are you interpreting the binary file and copying the values into the structure on the linux machine. looks like if you pad out the ut_time field with 4 MSB bytes then the file should become binary compatible with linux. i think you can either: a) read and interpet the binary value, copying the values from the binary value into the defined linux structure. b) change the irix programme to use a double long for the time field. c) write a utility to insert the padding. regards, Paul Jakma.