#include <time.h>
#include <sys/timeb.h>
char* gettime()
{
static char dt[50];
struct _timeb tb;
struct tm *ptm = NULL;
time_t currtime;
char s_currtime[9];
memset(s_currtime, 0x00, sizeof(s_currtime));
memset(&currtime, 0x00, sizeof(currtime));
//time(&currtime);
//ptm = localtime(&currtime);
_ftime(&tb);
ptm = localtime(&tb.time);
sprintf(dt, "%04d%02d%02d-%02d:%02d:%02d.%03d", ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday,
ptm->tm_hour, ptm->tm_min, ptm->tm_sec, tb.millitm);
return dt+8;
}