From owner-freebsd-standards Fri Mar 7 22:41:22 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 140DD37B405 for ; Fri, 7 Mar 2003 22:41:20 -0800 (PST) Received: from pop015.verizon.net (pop015pub.verizon.net [206.46.170.172]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1AF3043F85 for ; Fri, 7 Mar 2003 22:41:19 -0800 (PST) (envelope-from mtm@identd.net) Received: from kokeb.ambesa.net ([151.200.235.142]) by pop015.verizon.net (InterMail vM.5.01.05.27 201-253-122-126-127-20021220) with ESMTP id <20030308064118.MANA14460.pop015.verizon.net@kokeb.ambesa.net>; Sat, 8 Mar 2003 00:41:18 -0600 Date: Sat, 8 Mar 2003 01:41:17 -0500 From: Mike Makonnen To: freebsd-standards@freebsd.org Cc: Mark Murray Subject: PR: misc/48993 strptime behaviour X-Mailer: Sylpheed version 0.8.10 (GTK+ 1.2.10; i386-portbld-freebsd5.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Authentication-Info: Submitted using SMTP AUTH at pop015.verizon.net from [151.200.235.142] at Sat, 8 Mar 2003 00:41:18 -0600 Message-Id: <20030308064118.MANA14460.pop015.verizon.net@kokeb.ambesa.net> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello folks, The submitter says some third party software he installed failed because it expected the tm_wday and tm_yday of the tm structure to be automatically filled in by strptime(3) (Apparently, this is the behaviour on linux). Our implementation fills them in if the %s (number of seconds since the Epoch) or %Z (time zone name) specifiers are used. Otherwise, it fills in only the fields specified in the format string. I think it's preferable to have them filled in automatically all the time and not just sometimes, but I'm not sure if this would be a violation of some unix standard. Can anyone shed some light on what the behaviour is supposed to be? If there are no issues I will commit the following patch. Cheers. -- Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc mtm@identd.net | Fingerprint: D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC 68B9 Index: stdtime/strptime.c =================================================================== RCS file: /home/ncvs/src/lib/libc/stdtime/strptime.c,v retrieving revision 1.30 diff -u -r1.30 strptime.c --- stdtime/strptime.c 16 Feb 2003 17:29:11 -0000 1.30 +++ stdtime/strptime.c 7 Mar 2003 18:09:24 -0000 @@ -521,17 +521,18 @@ struct tm * __restrict tm) { char *ret; + time_t t; if (__isthreaded) _pthread_mutex_lock(&gotgmt_mutex); got_GMT = 0; ret = _strptime(buf, fmt, tm); - if (ret && got_GMT) { - time_t t = timegm(tm); + if (ret) { + t = got_GMT ? timegm(tm) : mktime(tm); localtime_r(&t, tm); - got_GMT = 0; } + got_GMT = 0; if (__isthreaded) _pthread_mutex_unlock(&gotgmt_mutex); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message