From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3695 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: time code progress Date: Fri, 19 Jul 2013 21:22:26 -0400 Message-ID: <20130720012226.GC3249@brightrain.aerifal.cx> References: <20130716194553.GA9438@brightrain.aerifal.cx> <20130717093325.GA12469@brightrain.aerifal.cx> <20130720011106.GC15323@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1374283359 23148 80.91.229.3 (20 Jul 2013 01:22:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Jul 2013 01:22:39 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3699-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jul 20 03:22:41 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1V0Lsf-0006im-2q for gllmg-musl@plane.gmane.org; Sat, 20 Jul 2013 03:22:41 +0200 Original-Received: (qmail 11386 invoked by uid 550); 20 Jul 2013 01:22:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11375 invoked from network); 20 Jul 2013 01:22:39 -0000 Content-Disposition: inline In-Reply-To: <20130720011106.GC15323@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3695 Archived-At: On Sat, Jul 20, 2013 at 03:11:06AM +0200, Szabolcs Nagy wrote: > * Rich Felker [2013-07-17 05:33:25 -0400]: > > Committed. Please let me know what bugs you find. :-) > > in mktime the overflow check is not strictly ok, > time_t is signed so the check relies on signed overflow A conversion is not an overflow. If the actual value does not fit, it results in an implementation-defined value (of the destination type) or an implementation-defined signal. I'm happy assuming our implementation does not do the latter, and even that it performs the conversion via modular reduction, but we don't need that assumption here. The fact that, if t does not fit in time_t, then NO value of type time_t can ever be equal to t, is all we need. > time_t seem to be long on all supported platforms so this should work: > > if (t>LONG_MAX || t