On Mon, 08 Apr 2002 18:47:06 -0500, "Glenn McCorkle" <[EMAIL PROTECTED]>
wrote:

GM> I can't seem to figure-out what's wrong with the date/time section.

GM> Any ideas from the rest of you ?

GM> ctime((time_t *)(&cacheitem.lastseen)),

GM> Is something wrong in the syntax???

GM> cacheitem.lastseen is "long"
GM> The correct 4 bytes are being "grabbed" from cache.idx

GM> Why are these 4 bytes... C2 1A B2 3C
GM> being converted to Jan 01, 00:00:00 1970

GM> C2 1A B2 3C = 1,018,305,218
GM> (date/time of file in question = Apr 08 18:33:42 2002 )

On Mon, 08 Apr 2002 23:16:27 -0500, "Glenn McCorkle" <[EMAIL PROTECTED]>
wrote:

GM> Try it for yourself. ;-)

GM> --- 04082002.cpp ---
GM> #include <stdio.h>
GM> #include <time.h>

GM> int main(void)
GM> {
GM>    time_t t;

GM>    time(&t);
GM>    printf("Today's date and time: %s\n", ctime(&t));
GM>    long c=1018305218l;
GM>    printf("date/time of 1,018,305,218: %s\n", ctime(&c));
GM>    return 0;
GM> }
 
GM> ____________________

Just looked through the above examples. If long c=1018305218l and ctime(&c)
works, what's wrong with cacheitem.lastseen which is "long"? Use
ctime(&cacheitem.lastseen) instead of ctime((time_t *)(&cacheitem.lastseen)),
and be happy. Or use

long c = cacheitem.lastseen;

and then

ctime(&c);





Deeply yours,

 M   M
 MM MM
 M M M  I  T  H  G  O  L
 M   M                            http://mithgol.pp.ru/
            T  H  E                  [EMAIL PROTECTED]
W     W
W  W  W   E  B  M  A  S  T  E  R
 W W W
  W W

Reply via email to