POSIX mandates EOVERFLOW for this condition.
struct tm *__gmtime_r(const time_t *restrict t, struct tm *restrict tm)
{
if (__secs_to_tm(*t, tm) < 0) {
- errno = EINVAL;
+ errno = EOVERFLOW;
return 0;
}
tm->tm_isdst = 0;
{
__secs_to_zone(*t, 0, &tm->tm_isdst, &tm->__tm_gmtoff, 0, &tm->__tm_zone);
if (__secs_to_tm((long long)*t - tm->__tm_gmtoff, tm) < 0) {
- errno = EINVAL;
+ errno = EOVERFLOW;
return 0;
}
return tm;
return t;
error:
- errno = EINVAL;
+ errno = EOVERFLOW;
return -1;
}
struct tm new;
long long t = __tm_to_secs(tm);
if (__secs_to_tm(t, &new) < 0) {
- errno = EINVAL;
+ errno = EOVERFLOW;
return -1;
}
*tm = new;