cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLINFO_FILETIME usage

From: Tor Arntsen <tor_at_spacetec.no>
Date: Mon, 19 Dec 2005 17:21:14 +0100

On Dec 19, 16:50, "C.Alvarez" wrote:
>for CURLINFO_FILETIME, the doc explains it returns the document amount of seconds since 01.01.1970, but how to calculate the actual date with this value ??

I don't know about Windows, but on unix-like platforms you can do something
like this:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
..
printf ("date and time:\n", ctime (seconds_since_1970));
/* or */
printf ("date and time:\n", asctime (localtime (seconds_since_1970));
/* or */
struct tm tm = gmtime (seconds_since_1970);
/* or */
struct tm tm = localtime (seconds_since_1970);
printf ("day mon year hr min sec\n", tm.tm_mday, tm.tm_mon+1,
        tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
/* or something to that effect. Check 'struct tm', 'time_m' & co.
in 'man time' (or whatever is the equivalent docu on Windows)

-Tor
(nb: The above isn't actually compiled and checked)
Received on 2005-12-19