forked from speed-dreams/speed-dreams-code
Platform-friendly time handling
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3211 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: e741f289e99ee6e8ff66e73874ae206951d817ec Former-commit-id: 96b1548b2009ed95c59c5003ab1aa4b64c813efe
This commit is contained in:
parent
c1f6701cd2
commit
a0ca7e511e
1 changed files with 15 additions and 5 deletions
|
@ -28,8 +28,8 @@
|
|||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
|
@ -1695,17 +1695,27 @@ GfParmWriteFileSDHeader (const char *file, void *parmHandle, const char *name)
|
|||
if (First)
|
||||
{
|
||||
First = false;
|
||||
|
||||
char time_buf[255];
|
||||
#ifdef WIN32
|
||||
_strdate_s(time_buf, sizeof(time_buf));
|
||||
#else
|
||||
time_t rawtime;
|
||||
struct tm *timeinfo;
|
||||
time( &rawtime );
|
||||
timeinfo = localtime( &rawtime );
|
||||
strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %X", timeinfo);
|
||||
#endif //WIN32
|
||||
|
||||
fputs ("<!--\n", fout);
|
||||
fputs (" file : ", fout);
|
||||
strncpy(buf,file,strlen(file)-4);
|
||||
buf[strlen(file)-4] = 0;
|
||||
fputs (buf, fout);
|
||||
fputs ("\n created : ", fout);
|
||||
_strdate_s(buf,sizeof(buf));
|
||||
fputs (buf, fout);
|
||||
fputs (time_buf, fout);
|
||||
fputs ("\n last modified : ", fout);
|
||||
_strdate_s(buf,sizeof(buf));
|
||||
fputs (buf, fout);
|
||||
fputs (time_buf, fout);
|
||||
fputs ("\n copyright : (C) 2010 Wolf-Dieter Beelitz\n", fout);
|
||||
fputs ("\n", fout);
|
||||
fputs (" SVN version : $Id$\n", fout);
|
||||
|
|
Loading…
Reference in a new issue