🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #13116

Re: Conversion a fecha y hora.

#13116
From: J.A. Gutierrez
Date: Mon, 02 Apr 2001 10:02
47 lines
2363 bytes
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: <9a9ioi$6v2$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!193.251.151.101!opentransit.net!jussieu.fr!news.rediris.es!news.unizar.es!not-for-mail
References: <9a842h$bbj$1@noucreus.cesca.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: f86c8,3099660242abfed4
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-04-02 02:54:59 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!193.251.151.101!opentransit.net!jussieu.fr!news.rediris.es!news.unizar.es!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Conversion a fecha y hora.
Date: 2 Apr 2001 10:02:58 GMT
Organization: Rank
Lines: 47
Message-ID: <9a9ioi$6v2$1@news.unizar.es>
References: <9a842h$bbj$1@noucreus.cesca.es>
NNTP-Posting-Host: daphne.cps.unizar.es
X-Trace: news.unizar.es 986205778 7138 155.210.152.20 (2 Apr 2001 10:02:58 GMT)
X-Complaints-To: usenet@news.unizar.es
NNTP-Posting-Date: 2 Apr 2001 10:02:58 GMT
User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (IRIX/6.2 (IP22))