From owner-freebsd-bugs Sat Jul 6 16:20: 8 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BE4D337B400 for ; Sat, 6 Jul 2002 16:20:02 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 191D243E31 for ; Sat, 6 Jul 2002 16:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g66NK1JU080102 for ; Sat, 6 Jul 2002 16:20:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g66NK1WX080101; Sat, 6 Jul 2002 16:20:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B52837B400 for ; Sat, 6 Jul 2002 16:16:02 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B2FB43E09 for ; Sat, 6 Jul 2002 16:16:02 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g66NG1OT080601 for ; Sat, 6 Jul 2002 16:16:01 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g66NG19j080600; Sat, 6 Jul 2002 16:16:01 -0700 (PDT) Message-Id: <200207062316.g66NG19j080600@www.freebsd.org> Date: Sat, 6 Jul 2002 16:16:01 -0700 (PDT) From: Martin Müller To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/40278: mktime returns -1 for certain dates/timezones when it should normalize Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 40278 >Category: bin >Synopsis: mktime returns -1 for certain dates/timezones when it should normalize >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 06 16:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Martin Müller >Release: 4.6-STABLE >Organization: Business Network Communications AG >Environment: FreeBSD taos.bnc.ch 4.6-STABLE FreeBSD 4.6-STABLE #0: Sun Jun 16 20:17:27 CEST 2002 root@laguna.bnc.ch:/usr/obj/usr/src/sys/BNC-MP-4.6 i386 >Description: When adding one month to Fri Mar 1 02:00:00 2002 and at the same time changing tm_mday to zero (should return last day of March) by calling mktime with a struct tm, the return is -1. This behaviour seems to occur when using dates that do not really exist because of DST and mktime is not able to recover during normalization. >How-To-Repeat: Put your computer in CEST timezone, fill in a struct tm to match Fri Mar 1 02:00:00 2002, call mktime. Then tm_mon +=1 and tm_mday = 0, call mktime again, this will return -1. If you call mktime two times, changing only one value at a time, the output is correct (because mktime will normalize struct tm correctly). >Fix: Possibly by changing "timesub(&t, ttisp->tt_gmtoff, sp, tmp);" to "timesub(&t, 0L, sp, tmp);" at ligne 1078 in localtime.c (/usr/src/lib/libc/stdtime/). >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message