Hello,
I would glad to make my time stamp string smaller, for windows, bsd,... 8 chars would be ok.
The simple, universal, tiny, algorithm shall convert back and forth (<->) the time stamp <-> 8 chars.
some basic starting point:
I would glad to make my time stamp string smaller, for windows, bsd,... 8 chars would be ok.
The simple, universal, tiny, algorithm shall convert back and forth (<->) the time stamp <-> 8 chars.
some basic starting point:
Code:
char *strtimestamp()
{
long t;
struct tm *ltime;
time(&t);
ltime=localtime(&t);
char charo[50]; int fooi ;
fooi = snprintf( charo, 50 , "%04d%02d%02d%02d%02d%02d",
1900 + ltime->tm_year, ltime->tm_mon +1 , ltime->tm_mday,
ltime->tm_hour, ltime->tm_min, ltime->tm_sec
);
size_t siz = sizeof charo ;
char *r = malloc( sizeof charo );
return r ? memcpy(r, charo, siz ) : NULL;
}