On 2/8/24 11:20, Simon Josefsson wrote:
A term "safe" is subjective (safer than what? does it preclude even
safer variants?), how about using the 'c_' prefix?
That's why I used "safer_" rather than "safe_" - it's safer than ctime
(though of course nothing is 100% safe).
"c_" is not appropriate because it means the C locale. ctime already
means the C locale.
We could use some other prefix I suppose.
So unless I'm missing something I envision these new functions:
#define CTIME_BUFSIZE
char *c_asctime(const struct tm *tm);
char *c_asctime_r(const struct tm *tm, char *buf);
char *c_ctime(const time_t *timep);
char *c_ctime_r(const time_t *timep, char *buf);
Sounds a bit complicated...
Since asctime_r and ctime_r have already been removed from draft next
POSIX, let's not name anything after them.
Why do we need asctime? It's just a recipe for trouble.
I'm hoping we can get by with just your c_ctime_r (but with a better
name) and skip the other simple APIs. If someone something else they can
use a more-detailed strftime-like API.