Article View: es.comp.os.linux.programacion
Article #13019Re: Conversion a fecha y hora.
From: AGS
Date: Wed, 04 Apr 2001 22:26
Date: Wed, 04 Apr 2001 22:26
57 lines
2742 bytes
2742 bytes
Gracias!
Me ha funcionado perfectamente.
Saludos.
"J.A. Gutierrez" <spd@daphne.cps.unizar.es> escribi๏ฟฝ en el mensaje
news:9a9ioi$6v2$1@news.unizar.es...
> AGS <aguillam[nospam]@pie.xtec.es> wrote:
>
> : Resulta que observando el fichero access.log que genera el squid, he
> : observador que al principio de cada linea aparece un numero similar al
> : siguiente: 986131329.379.
>
> : Yo me supongo que este numero debe de corresponder a la fecha y la hora
en
> : que se ha hecho la anotacion. Quisiera poder convertir este numero a
fecha y
> : hora entendible segun el formato convencional de dd/mm/aa hh:mm:ss.
>
> --------------------------------------------------------------------------
-
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <time.h>
>
>
> main(int argc, char **argv)
> {
> time_t timer;
>
> if ( argc > 1 )
> {
> timer = strtol( argv[optind], (char **)NULL, 0 );
> }
> else
> {
> time(&timer);
> }
> fprintf(stdout, "%d\n", timer ); fflush(stdout);
> fprintf(stderr, "%s", ctime(&timer));
> exit(0);
> }
>
> --------------------------------------------------------------------------
-
>
> $ time_t 986131329
> 986131329
> Sun Apr 1 15:22:09 2001
>
>
> --
> PGP and other useless info at \ La ciencia-ficcion es
> http://www.cps.unizar.es/~spd/ \ ese futuro en el que
> finger://daphne.cps.unizar.es/spd \ lo seguro es que ya
> ftp://ivo.cps.unizar.es/pub/ \ (F. Alfaro) no seremos jovenes
Technical Details
Message-ID:
<9ag7ch$p1v$1@noucreus.cesca.es>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.rediris.es!news.cesca.es!not-for-mailReferences:
<9a842h$bbj$1@noucreus.cesca.es> <9a9ioi$6v2$1@news.unizar.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,3099660242abfed4 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2001-04-04 15:32:09 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.rediris.es!news.cesca.es!not-for-mail From: "AGS" <aguillam[nospam]@pie.xtec.es> Newsgroups: es.comp.os.linux.programacion Subject: Re: Conversion a fecha y hora. Date: Thu, 5 Apr 2001 00:26:08 +0200 Organization: CESCA - Servidor de news de l'Anella Cientifica Lines: 59 Message-ID: <9ag7ch$p1v$1@noucreus.cesca.es> References: <9a842h$bbj$1@noucreus.cesca.es> <9a9ioi$6v2$1@news.unizar.es> NNTP-Posting-Host: i5176.infovia.xtec.es X-Trace: noucreus.cesca.es 986423505 25663 193.145.95.176 (4 Apr 2001 22:31:45 GMT) X-Complaints-To: newsmanager@cesca.es NNTP-Posting-Date: Wed, 4 Apr 2001 22:31:45 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400