From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 24736 invoked from network); 19 May 1999 08:30:55 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 19 May 1999 08:30:55 -0000 Received: from dns.rgn.it (dns.rgn.it [151.99.243.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id DAA10292 for ; Wed, 19 May 1999 03:52:05 -0400 Received: (from franco@localhost) by dns.rgn.it (8.9.3/8.9.3) id JAA11755 for axp-list@redhat.com; Wed, 19 May 1999 09:51:33 +0200 (CEST) From: "Franco Tassone" Message-Id: <9905190951.ZM11753@dns.rgn.it> Date: Wed, 19 May 1999 09:51:32 +0000 In-Reply-To: Michal Jaegermann "Re: Converting time (since 01-01-1970) to Epoch" (May 18, 10:13am) References: <199905181613.KAA20322@ellpspace.math.ualberta.ca> X-Mailer: Z-Mail (3.2.3 08feb96 MediaMail) To: axp-list@redhat.com Subject: Re: Converting time (since 01-01-1970) to Epoch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 -------------------------------------------------------------