On 2024-02-09 07:06, Bruno Haible wrote:
So CTIME_BUFSIZE should be 35?
With 50 years of computer science experience, we should have learned
the lesson to allocate more room than sounds necessary*now*. If
now you think 35 will be sufficient for all times, then we should
better choose twice that value: 70.

We needn't be that pessimistic. We can use something like this:

  #define CTIME_BUFSIZE \
    (sizeof "Wed Jun 30 21:49:08 \n" \
     + INT_STRLEN_BOUND (time_t) - 7)

7 = floor(log10(60*60*24*365)). This evaluates to 35 on typical machines today, and will grow automatically if time_t gets wider - it could even exceed 70 if needed (though I think this unlikely).

Reply via email to