Date: Sat, 8 Mar 2003 01:41:17 -0500 From: Mike Makonnen <mtm@identd.net> To: freebsd-standards@freebsd.org Cc: Mark Murray <mark@grondar.org> Subject: PR: misc/48993 strptime behaviour Message-ID: <20030308064118.MANA14460.pop015.verizon.net@kokeb.ambesa.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030308064118.MANA14460.pop015.verizon.net>