strfmarstime testing and verification - date time format locales
The %c format specifier checks the system locale for how to format the date and time.
Of course, it’s a good idea to test this. It took me a while.. unfortunately I don’t have a way of checking in test configuration if one of the formats is installed on the host system (see https://en.wikipedia.org/wiki/List_of_date_formats_by_country). I also don’t really have a nice way (as far as I know) to set test environment variables.
So what I ended on was in the test setup, just passing the LC_ALL environment variable. But this was broken for some reason?
Ah, it turns out that my logic in strfmarstime to get the locale was incorrect. For some reason,
setlocale(LC_ALL, NULL);
does not work, and you have to use “”. My guess is that NULL goes to system default, and “” will read from environment variables.
Yay!
While Day-Month-Year format is straight forward, the few countries that use Year-Month-Day are driving me insane, like Hungary, because their formats have like, dots in them, and I’m not seeing much consistency across the other country’s formats that also have Year-Month-Day formatting.
I’ll come back to it later. It’s actually broken anyway, because my week number representations are still wrong.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.