62#define Locale (&C_time_locale)
66 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
67 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
69 "January",
"February",
"March",
"April",
"May",
"June",
70 "July",
"August",
"September",
"October",
"November",
"December"
72 "Sun",
"Mon",
"Tue",
"Wed",
75 "Sunday",
"Monday",
"Tuesday",
"Wednesday",
76 "Thursday",
"Friday",
"Saturday"
106 "%a %b %e %H:%M:%S %Z %Y"
114static char *
_add(
const char *
str,
char *pt,
const char *ptlim);
115static char *
_conv(
int n,
const char *
format,
char *pt,
const char *ptlim);
116static char *
_fmt(
const char *
format,
const struct pg_tm *t,
char *pt,
const char *ptlim,
118static char *
_yconv(
int a,
int b,
bool convert_top,
bool convert_yy,
char *pt,
char const *ptlim);
131 int saved_errno = errno;
140 if (p == s + maxsize)
152 const char *ptlim,
enum warn *warnp)
197 true,
false, pt, ptlim);
203 pt =
_fmt(
Locale->c_fmt, t, pt, ptlim, &warn2);
211 pt =
_fmt(
"%m/%d/%y", t, pt, ptlim, warnp);
230 pt =
_fmt(
"%Y-%m-%d", t, pt, ptlim, warnp);
260 pt =
_add(
"kitchen sink", pt, ptlim);
282 pt =
_add(
"\n", pt, ptlim);
291 pt =
_fmt(
"%H:%M", t, pt, ptlim, warnp);
294 pt =
_fmt(
"%I:%M:%S %p", t, pt, ptlim, warnp);
300 pt =
_fmt(
"%H:%M:%S", t, pt, ptlim, warnp);
303 pt =
_add(
"\t", pt, ptlim);
367 bot = ((yday + 11 -
wday) %
386 w = 1 + ((yday - bot) /
396 pt =
_conv(w,
"%02d",
417 pt =
_fmt(
"%e-%b-%Y", t, pt, ptlim, warnp);
430 pt =
_fmt(
Locale->X_fmt, t, pt, ptlim, warnp);
436 pt =
_fmt(
Locale->x_fmt, t, pt, ptlim, &warn2);
477 negative = t->
tm_zone[0] ==
'-';
490 pt =
_conv(diff,
"%04d", pt, ptlim);
525_add(
const char *
str,
char *pt,
const char *ptlim)
527 while (pt < ptlim && (*pt = *
str++) !=
'\0')
541_yconv(
int a,
int b,
bool convert_top,
bool convert_yy,
542 char *pt,
const char *ptlim)
551 if (trail < 0 && lead > 0)
556 else if (lead < 0 && trail > 0)
563 if (lead == 0 && trail < 0)
564 pt =
_add(
"-0", pt, ptlim);
566 pt =
_conv(lead,
"%02d", pt, ptlim);
569 pt =
_conv(((trail < 0) ? -trail : trail),
"%02d", pt, ptlim);
#define INT_STRLEN_MAXIMUM(type)
static char * _add(const char *str, char *pt, const char *ptlim)
static char * _fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim, enum warn *warnp)
static char * _yconv(int a, int b, bool convert_top, bool convert_yy, char *pt, char const *ptlim)
static char * _conv(int n, const char *format, char *pt, const char *ptlim)
size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
static const struct lc_time_T C_time_locale
const char * mon[MONSPERYEAR]
const char * weekday[DAYSPERWEEK]
const char * wday[DAYSPERWEEK]
const char * month[MONSPERYEAR]