Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 242,774 of 243,242    |
|    Michael Sanders to Kenny McCormack    |
|    Re: printf and time_t    |
|    05 Jan 26 08:32:30    |
      From: porkchop@invalid.foo              On Mon, 5 Jan 2026 07:19:02 -0000 (UTC), Kenny McCormack wrote:              > Here's kind of an old chestnut...       >       > The question is: How can you reliably printf() a time_t value?       > What conversion spec should you use?       >       > The answer seems to be: try stuff until the compiler doesn't warn.       >       > Note that there is now %z for size_t, but there really should be a "Just do       > the right thing - you're the compiler, you know what type the arg is, do       > the right thing" spec.       >       > It turns out that in my use case, %lu works, but how can you know?       > Note, BTW, that another way to do it is to use %d and case the time_t value       > to (int), but that seems kludgey.              Hi Kenny not sure this will help you but check out |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca