23 const char *wday_abbr[] = {
N_(
"Sun"),
N_(
"Mon"),
N_(
"Tue"),
N_(
"Wed"),
24 N_(
"Thu"),
N_(
"Fri"),
N_(
"Sat")};
25 const char *wday_full[] = {
N_(
"Sunday"),
N_(
"Monday"),
N_(
"Tuesday"),
26 N_(
"Wednesday"),
N_(
"Thursday"),
N_(
"Friday"),
N_(
"Saturday")};
27 const char *mon_abbr[] = {
N_(
"Jan"),
N_(
"Feb"),
N_(
"Mar"),
N_(
"Apr"),
28 N_(
"abbrev^May"),
N_(
"Jun"),
N_(
"Jul"),
N_(
"Aug"),
N_(
"Sep"),
N_(
"Oct"),
29 N_(
"Nov"),
N_(
"Dec")};
30 const char *mon_full[] = {
N_(
"January"),
N_(
"February"),
N_(
"March"),
31 N_(
"April"),
N_(
"May"),
N_(
"June"),
N_(
"July"),
N_(
"August"),
32 N_(
"September"),
N_(
"October"),
N_(
"November"),
N_(
"December")};
37 bool locale_correct,
bool ampm_supported)
39 if (locale_correct && ampm_supported) {
45 for (std::string::const_iterator it = format.begin(); it != format.end();
51 if(it == format.end()) {
56 bool unrecognized =
false;
58 if (!locale_correct) {
61 new_format += (time->tm_wday < 0 || time->tm_wday > 6) ?
65 new_format += (time->tm_wday < 0 || time->tm_wday > 6) ?
70 new_format += (time->tm_mon < 0 || time->tm_mon > 11) ?
74 new_format += (time->tm_mon < 0 || time->tm_mon > 11) ?
78 new_format +=
reformat(
_(
"%a %b %e %H:%M:%S %Y"), time,
79 locale_correct, ampm_supported);
82 new_format +=
reformat(
_(
"%a %d %b %Y %H:%M:%S %z"),
83 time, locale_correct, ampm_supported);
90 if (!ampm_supported || !locale_correct) {
93 new_format += (time->tm_hour < 12 ?
_(
"AM") :
_(
"PM"));
96 new_format += (time->tm_hour < 12 ?
_(
"am") :
_(
"pm"));
118 const unsigned buffer_size = 16;
119 char time_buffer[buffer_size] = {0};
121 size_t ret =
std::strftime(time_buffer, buffer_size,
"%p", time);
bool & time_locale_correct()
size_t strftime(char *str, size_t count, const std::string &format, const std::tm *time)
static bool locale_supports_ampm(const std::tm *time)
static std::string reformat(const std::string &format, const std::tm *time, bool locale_correct, bool ampm_supported)
static UNUSEDNOWARN std::string _(const char *str)
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static UNUSEDNOWARN std::string sgettext(const char *str)
GLsizei const GLcharARB ** string