All of lore.kernel.org
 help / color / mirror / Atom feed
* timegm(3): behavior is not described in case of error
@ 2016-10-25 12:58 Vincent Lefevre
       [not found] ` <20161025125816.GA29678-d/FE5ZiCopwvkDgRb4gLyeMIjtZQB4uX@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Lefevre @ 2016-10-25 12:58 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

In the timegm(3) man page, the behavior is not described in case of
error, i.e. if the result is not representable in a time_t (e.g.,
with a huge year).

The glibc manual says:

     'timegm' is functionally identical to 'mktime' except it always
     takes the input values to be Coordinated Universal Time (UTC)
     regardless of any local time zone setting.

So, I assume that (time_t) -1 is returned in such a case, just like
mktime.

The man page could add a sentence like the glibc manual one, or
explicitly say what happens in case of error like in the mktime(3)
man page.

This is mainly for the timegm() function. For the timelocal() function,
the man page already says:

    The timelocal() function is equivalent to the POSIX standard
    function mktime(3). [...]

-- 
Vincent Lefèvre <vincent-buymaDBGzMOsTnJN9+BGXg@public.gmane.org> - 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: timegm(3): behavior is not described in case of error
       [not found] ` <20161025125816.GA29678-d/FE5ZiCopwvkDgRb4gLyeMIjtZQB4uX@public.gmane.org>
@ 2016-11-06 11:30   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-11-06 11:30 UTC (permalink / raw)
  To: Vincent Lefevre
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Vincent,

On 10/25/2016 06:58 AM, Vincent Lefevre wrote:
> In the timegm(3) man page, the behavior is not described in case of
> error, i.e. if the result is not representable in a time_t (e.g.,
> with a huge year).
> 
> The glibc manual says:
> 
>      'timegm' is functionally identical to 'mktime' except it always
>      takes the input values to be Coordinated Universal Time (UTC)
>      regardless of any local time zone setting.
> 
> So, I assume that (time_t) -1 is returned in such a case, just like
> mktime.

Yes.

> The man page could add a sentence like the glibc manual one, or
> explicitly say what happens in case of error like in the mktime(3)
> man page.

I've added such a sentence. (Changes are pushed to Git.) 
Thanks for the report!

Cheers,

Michael

> This is mainly for the timegm() function. For the timelocal() function,
> the man page already says:
> 
>     The timelocal() function is equivalent to the POSIX standard
>     function mktime(3). [...]
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-06 11:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 12:58 timegm(3): behavior is not described in case of error Vincent Lefevre
     [not found] ` <20161025125816.GA29678-d/FE5ZiCopwvkDgRb4gLyeMIjtZQB4uX@public.gmane.org>
2016-11-06 11:30   ` Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.