Re: [PATCH v2] ctime.3: Document how to check errors from mktime(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paul,

On Fri, Aug 23, 2024 at 01:55:19PM GMT, Paul Eggert wrote:
> On 2024-08-23 13:43, Alejandro Colomar wrote:
> > strftime("%s") would be interesting, but it accepts a struct tm, not a
> > time_t
> 
> That's not a problem, since mktime effectively returns a struct tm as well
> as a time_t.
> 
> You should not use strftime with %s, though, since that might not work on
> some platforms during fall-back periods. You can use strftime with "%Y-%m-%d
> %H:%M:%S %z".

That still does not allow to see the return value of mktime, which I
think is interesting in the example (for example, it exemplifies how a
valid date can return -1).  It also shows the different return values
when different tm_isdst values are passed for the same date.  I'll keep
the printf(3).

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux