#include <stdio.h>
#include <time.h>
#include <string.h>
char *create_time_tag(char *buf, int length)
{
tnow = localtime(&now);
memset(buf, 0, length);
snprintf(buf, length,"%04d/%02d/%02d %02d:%02d:%02d\n",
1900+tnow->tm_year,
tnow->tm_mon+1,
tnow->tm_mday,
tnow->tm_hour,
tnow->tm_min,
tnow->tm_sec
);
return buf;
}
#include <time.h>
#include <string.h>
char *create_time_tag(char *buf, int length)
{
time_t now;
struct tm *tnow = NULL;
now = time(NULL);tnow = localtime(&now);
memset(buf, 0, length);
snprintf(buf, length,"%04d/%02d/%02d %02d:%02d:%02d\n",
1900+tnow->tm_year,
tnow->tm_mon+1,
tnow->tm_mday,
tnow->tm_hour,
tnow->tm_min,
tnow->tm_sec
);
return buf;
}