Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jan 2000 11:43:37 -0600
From:      Dan Nelson <dnelson@emsphone.com>
To:        Alexander Langer <alex@big.endian.de>
Cc:        Thomas David Rivers <rivers@dignus.com>, hackers@FreeBSD.ORG
Subject:   Re: mktime(3) and strange struct tm entries
Message-ID:  <20000107114337.A17459@dan.emsphone.com>
In-Reply-To: <20000107173623.B4381@cichlids.cichlids.com>; from "Alexander Langer" on Fri Jan  7 17:36:23 GMT 2000
References:  <19991231171423.A4219@cichlids.cichlids.com> <200001071628.LAA76267@lakes.dignus.com> <20000107173623.B4381@cichlids.cichlids.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 07), Alexander Langer said:
> Thus spake Thomas David Rivers (rivers@dignus.com):
> 
> >  I believe this is correct behaviour.
> 
> Ok. I got a further question:
> >From ctime(3):
>      til tm_mon and tm_year are determined.  Mktime() returns the
>      specified calendar time; if the calendar time cannot be
>      represented, it returns -1;
> 
> Which calendar time is meant?
> IMO November 31th is void and cannot be represented.

The manpage also states:

     The original values of the tm_wday and tm_yday components of the
     structure are ignored, and the original values of the other
     components are not restricted to their normal ranges.
...
     On successful completion, the values of the tm_wday and tm_yday
     components of the structure are set appropriately, and the other
     components are set to represent the specified calendar time, but
     with their values forced to their normal ranges.

Nov 31 cannot be represented, but it gets normalized to Dec 1.  The
only non-representable dates are those that cannot be stored in a
time_t.

-- 
	Dan Nelson
	dnelson@emsphone.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000107114337.A17459>