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 12:14:40PM GMT, Paul Eggert wrote:
> On 2024-08-23 11:17, Alejandro Colomar wrote:
> 
> > in systems where time_t is unsigned, does a mktime(3)
> > call with a time representing a time before Epoch result in an error,
> 
> Yes, just like any out-of-range mktime would.

Thanks!  (I thought it might wrap around for things that fit the signed
counterpart.)

> > Does any existing system (or historic one) use an unsigned time_t
> 
> Yes.

Hmmm, I guess we can do

	if (is_signed(time_t))
		printf("%jd\n", (intmax_t) t);
	else
		printf("%ju\n", (uintmax_t) t);

strftime("%s") would be interesting, but it accepts a struct tm, not a
time_t, so I can't pass that value directly from mktime(3) to
strftime(3).

Have a lovely night!
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