View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001125 | 1003.1(2016/18)/Issue7+TC2 | Base Definitions and Headers | public | 2017-03-07 11:24 | 2024-06-11 09:09 |
Reporter | Florian Weimer | Assigned To | |||
Priority | normal | Severity | Editorial | Type | Clarification Requested |
Status | Closed | Resolution | Accepted As Marked | ||
Name | Florian Weimer | ||||
Organization | Red Hat | ||||
User Reference | https://sourceware.org/bugzilla/show_bug.cgi?id=21229 | ||||
Section | strftime, strftime_l | ||||
Page Number | unknown | ||||
Line Number | unknown | ||||
Interp Status | --- | ||||
Final Accepted Text | See 0001125:0004084. | ||||
Summary | 0001125: Do strftime, strftime_l set tzname, daylight, timezone? | ||||
Description | The description for strftime says that “Local timezone information is used as though strftime() called tzset().” It does not specify whether the side effects that are normally associated with tzset (updates to the tzname, daylight, timezone variables) are observable by a caller to strftime or strftime_l. | ||||
Desired Action | Change the sentence to: “Local timezone information is used as though strftime() called tzset(). It is unspecified whether the tzname, [XSI] [Option Start] daylight, or timezone [Option End] variables are updated by a call to strftime().” | ||||
Tags | tc3-2008 |
|
The intention is that strftime() must update tzname[]. This was stated explicitly in POSIX.1-1990 and POSIX.1-1996 in section 8.1.1 after the description of the TZ rules: Whenever ctime(), strftime(), mktime(), or localtime() is called, the time zone names contained in the external variable tzname shall be set as if the tzset() function had been called. However, the merge with SUS in 2001 did not retain this statement with the TZ description in XBD, instead relying on the "as though" statements in the individual function descriptions. There is also this statement in the tzset() APPLICATION USAGE section: Since the ctime(), localtime(), mktime(), strftime(), and strftime_l() functions are required to set timezone information as if by calling tzset(), there is no need for an explicit tzset() call before using these functions. However, portable applications should call tzset() explicitly before using ctime_r() or localtime_r() because setting timezone information is optional for those functions. Note that the "as though" wording on the strftime() page is exactly the same as on the localtime() page, and I assume nobody would question the requirement for localtime() to set tzname[]. Interestingly, the mktime() page has slightly different wording: Local timezone information shall be set as though mktime() called tzset(). I suggest that we should change the localtime() and strftime() pages to use this wording. |
|
It looks like an implementation could keep updating these variables, but never the read from them, so there wouldn't be a thread safety hazard for multi-threaded programs. (Especially if all internal uses of strftime etc. used variants of these functions which skipped the update of these global variables.) |
|
In localtime() DESCRIPTION section on P1265, L42209-42210, change:Local timezone information is used as though localtime() calls tzset(). to: Local timezone information shall be set as though localtime() called tzset(). In strftime() DESCRIPTION section on P2045, L65543, change: Local timezone information is used as though strftime() calls tzset(). to: Local timezone information shall be set as though strftime() called tzset(). |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-03-07 11:24 | Florian Weimer | New Issue | |
2017-03-07 11:24 | Florian Weimer | Name | => Florian Weimer |
2017-03-07 11:24 | Florian Weimer | Organization | => Red Hat |
2017-03-07 11:24 | Florian Weimer | User Reference | => https://sourceware.org/bugzilla/show_bug.cgi?id=21229 |
2017-03-07 11:24 | Florian Weimer | Section | => strftime, strftime_l |
2017-03-07 11:24 | Florian Weimer | Page Number | => unknown |
2017-03-07 11:24 | Florian Weimer | Line Number | => unknown |
2017-03-07 15:52 | geoffclare | Note Added: 0003611 | |
2017-03-07 16:02 | Florian Weimer | Note Added: 0003612 | |
2018-08-16 16:17 | Don Cragun | Note Added: 0004084 | |
2018-08-16 16:18 | Don Cragun | Interp Status | => --- |
2018-08-16 16:18 | Don Cragun | Final Accepted Text | => See 0001125:0004084. |
2018-08-16 16:18 | Don Cragun | Status | New => Resolved |
2018-08-16 16:18 | Don Cragun | Resolution | Open => Accepted As Marked |
2018-08-16 16:19 | Don Cragun | Tag Attached: tc3-2008 | |
2019-10-31 11:26 | geoffclare | Status | Resolved => Applied |
2024-06-11 09:09 | agadmin | Status | Applied => Closed |