From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 9897 invoked from network); 20 May 1999 00:56:34 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 20 May 1999 00:56:34 -0000 Received: from asxfw2.asx.com.au (loghost.asx.com.au [203.15.147.65]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id UAA01804 for ; Wed, 19 May 1999 20:17:26 -0400 Received: (from uucp@localhost) by asxfw2.asx.com.au (8.9.3/8.9.3/Finno) id KAA25251 for ; Thu, 20 May 1999 10:17:41 +1000 (EST) Received: from asx204.asx.com.au(10.2.8.133) by asxfw2.asx.com.au via smap (V4.2) id xma025084; Thu, 20 May 99 10:17:10 +1000 Received: from ASX235.asx.com.au (ASX235.asx.com.au) by asx204.asx.com.au (PMDF V5.0-6 #24333) id <01JBF0G80K4W002Q17@asx204.asx.com.au> for axp-list@redhat.com; Thu, 20 May 1999 10:13:22 +1000 (AEST) Received: by ASX235.asx.com.au with Internet Mail Service (5.5.2448.0) id ; Thu, 20 May 1999 10:15:38 +1000 Date: Thu, 20 May 1999 10:14:39 +1000 From: Tom King Subject: RE: Converting time (since 01-01-1970) to Epoch To: axp-list@redhat.com Message-id: <93ABDBC61612D211A3700000F80623EF0CDB91@ASX032.asx.com.au> X-Mailer: Internet Mail Service (5.5.2448.0) Content-transfer-encoding: 7BIT Is it possible that the SGI box is big-endian . The strings would be o.k. but the number would be byte reversed ( usually) I think MIPS have a mode setting where they can either act big-or little endian e.g little endian bytes for one would be 0 0 0 1 big endian bytes for one would be 1 0 0 0 ---------- From: Franco Tassone Sent: Wednesday, 19 May 1999 19:52 To: axp-list@redhat.com Subject: Re: Converting time (since 01-01-1970) to Epoch On May 18, 10:13am, Michal Jaegermann wrote: > Every Unix (and Linux) machine starts its epoch for time keeping > at that date. Watch this: > > perl -e 'print scalar gmtime 0, "\n";' > Thu Jan 1 00:00:00 1970 > > > Does anybody can help me in doing this, please ? > > What is really the problem? 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 ? -- ------------------------------------------------------------- Franco Tassone Tel: +39-085-4510954 RGNetWork Internet Service Provider Fax: +39-085-64070 Via G. D'Annunzio, 162 e-mail: admin@rgn.it 65127 PESCARA (ITALY) URL: http://www.rgn.it ------------------------------------------------------------- -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com