[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: CFITSIO: fits_write_date



"Creager, Robert S" wrote:
> 
> Help,
> 
> We seem to of run into an issue with CFITSIO, and I wanted someone's take
> who might of worked with this before.  Basically, when I use the Windows
> version of CFITSIO (2.037) to write the date (fits_write_date), the time is
> an hour earlier then the actual windows system time.  Tom has tried with
> both GMT settings in windows, with apparently no effect.  Thoughts?
> 
> Thanks,
> Rob
> 
 I don't have source for 2.037 - currently available is 2.201. In this version,
fits_write_date() just uses the time returned from the system function gmtime()
(or from localtime() if gmtime() returns NULL, but that shouldn't happen).
 If you have a C development tool for Windows you can see what gmtime() is returning
with this:

#include <time.h>
#include <stdio.h>

int main (int argc, char** argv)
{
  struct tm *newtime;
  long ltime;

  time( &ltime);
  newtime = gmtime(&ltime);
  printf ("GMT is %s\n", asctime(newtime));

  newtime = localtime (&ltime);
  printf ("local time is %s\n", asctime(newtime));

  return 0;
}

 The smallest executable Visual C++ can make of this is ~50Kbytes. I don't
want to open up ftp on this machine for security reasons, but if someone can
suggest a good public ftp site I can put the executable out there. Not sure
what it would prove, but at least we would know whether the problem is with
Windows' gmtime() or somewhere else.

John