Re: [PATCH v3] ctime.3: EXAMPLES: Add example program

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

 



On 2024-08-23 15:26:04 +0800, Xi Ruoyao wrote:
> On Fri, 2024-08-23 at 09:02 +0200, Alejandro Colomar wrote:
> > Is mktime(3) allowed to return -1 and set EOVERFLOW on a successful
> > call?
> > 
> > RETURN VALUE
> >      The mktime() function shall return the specified  time  since  the
> >      Epoch  encoded  as  a value of type time_t.  If the time since the
> >      Epoch cannot be represented, the function shall return  the  value
> >      (time_t)-1 and set errno to indicate the error.
> 
> For mktime the standard only says "return (time_t)-1."  It does not
> mention errno at all.  And the standard also says:
> 
>    The value of errno may be set to nonzero by a library function call
>    whether or not there is an error, provided the use of errno is not
>    documented in the description of the function in this document.
> 
> > Then I think the API is completely broken.  How should we check for
> > errors after a mktime(3) call?
> 
> Maybe, special case if tm contains Dec 31 1969 23:59:59 UTC...  But it's
> just stupid.
> 
> > If this is so, let me file a glibc bug requesting a fix of the API,
> > adding a promise that on success, errno will remain unset.
> 
> It's a bug in the standard, not glibc.  And the standard has deprecated
> it anyway.
> 
> https://www.open-std.org/JTC1/SC22/WG14/www/docs/n2566.pdf

I can see only asctime and ctime mentioned there, not mktime.
So mktime isn't deprecated, is it?

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




[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