19 #include "mysys_priv.h"
38 void get_date(
register char *
to,
int flag, time_t date)
40 reg2
struct tm *start_time;
42 #if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
46 skr=date ? (time_t) date : my_time(0);
47 #if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
48 if (flag & GETDATE_GMT)
49 gmtime_r(&skr,&tm_tmp);
51 localtime_r(&skr,&tm_tmp);
54 if (flag & GETDATE_GMT)
55 start_time= gmtime(&skr);
57 start_time= localtime(&skr);
59 if (flag & GETDATE_SHORT_DATE)
60 sprintf(to,
"%02d%02d%02d",
61 start_time->tm_year % 100,
65 sprintf(to, ((flag & GETDATE_FIXEDLENGTH) ?
66 "%4d-%02d-%02d" :
"%d-%02d-%02d"),
67 start_time->tm_year+1900,
70 if (flag & GETDATE_DATE_TIME)
72 ((flag & GETDATE_FIXEDLENGTH) ?
73 " %02d:%02d:%02d" :
" %2d:%02d:%02d"),
77 else if (flag & GETDATE_HHMMSSTIME)
78 sprintf(strend(to),
"%02d%02d%02d",