Cache calendar per clock instance, weekdays properly handle locales.

This commit is contained in:
Skirmantas Kligys
2020-02-05 11:02:42 -08:00
parent 3c268d83c2
commit d1f427618f
3 changed files with 101 additions and 95 deletions

View File

@ -42,11 +42,15 @@ if not compiler.has_header('filesystem')
endif
endif
code = '''#include<langinfo.h>
code = '''
#include <langinfo.h>
#include <locale.h>
int main(int argc, char** argv) {
locale_t locale = newlocale(LC_ALL, "en_US.UTF-8", nullptr);
char* str;
str = nl_langinfo(_NL_TIME_WEEK_1STDAY);
str = nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
str = nl_langinfo_l(_NL_TIME_WEEK_1STDAY, locale);
str = nl_langinfo_l(_NL_TIME_FIRST_WEEKDAY, locale);
freelocale(locale);
return 0;
}
'''