[tex-k] Re: CreationDate in dvips

Stephen Gildea gildea at stop.mail-abuse.org
Sun Mar 9 22:56:41 CET 2003


Thank you for adding this feature back in.

My own thoughts about the portability of this code are to do it the ANSI
way.  It currently looks like this:

#ifdef CREATIONDATE
#if (!defined(VMS) && !defined(MSDOS) && !(defined(OS2) && defined(_MSC_VER)) && !defined(ATARIST))
 /* VAXC/MSDOS don't like/need this !! */
#include <sys/types.h>
#include <sys/time.h> /* time(), at least on BSD Unix */
#endif
#include <time.h> /* asctime() and localtime(), at least on BSD Unix */
static time_t jobtime;

...

      jobtime=time(0);
      (void)fprintf(bitfile, "%%%%CreationDate: %s",
                                 asctime(localtime(&jobtime))) ;
#endif


I think that this code is old, and that these days that's too many headers
for any system.  time() and ctime() (and asctime() and localtime(), if
you want to do it that way) have been in ANSI/ISO C for over a dozen
years, all declared in <time.h>.

Thus:

#include <time.h>		/* time() and ctime() */
static time_t jobtime;

...

      jobtime = time(NULL);
      fprintf(bitfile, "%%%%CreationDate: %s", ctime(&jobtime));


More information about the tex-k mailing list