View Issue Details

IDProjectCategoryView StatusLast Update
00001691003.1(2008)/Issue 7Shell and Utilitiespublic2024-06-11 08:53
Reporterwpollock Assigned Toajosey  
PrioritynormalSeverityEditorialTypeEnhancement Request
Status ClosedResolutionAccepted As Marked 
NameWayne Pollock
Organization
User Reference
Sectiondate
Page NumberNA
Line NumberNA
Interp Status---
Final Accepted Text0000169:0000283
Summary0000169: date utility needs ``%s''
DescriptionThere is currently no simple way, short of writing a C program, to obtain the "seconds since the epoch", commonly referred to as "Unix time". I would like to request the date utility be extended to include an additional conversion specification of:

 %s seconds since 1970-01-01 00:00:00 UTC (see XBD Seconds Since the Epoch)
Desired ActionAdd the new conversion specifier
Tagsc99, issue8

Relationships

parent of 0001612 Closed Issue 8 drafts XSH strftime() new (I8) %s conversion requires too much of the struct tm 
parent of 0001797 Interpretation Required 1003.1(2024)/Issue8 strftime "%s" should be able to examine tm_gmtoff 
related to 0000047 Closedajosey 1003.1(2008)/Issue 7 Missing specifiers for date utility 
related to 0000466 Closedajosey 1003.1(2008)/Issue 7 date +%C problem 
related to 0000954 Closedajosey 1003.1(2008)/Issue 7 Add %s to strftime 

Activities

geoffclare

2009-10-16 09:07

manager   bugnote:0000262

Last edited: 2009-10-16 09:12

If the proposed change to date is made, we should also add %s to
strftime() and strptime() for consistency.

Although it would be kind-of redundant for those functions (being
equivalent to mktime() and localtime() respectively, plus conversion
to/from a string) it would be usable in user-supplied/configured
format strings.

The detailed changes needed would be ...
After line 82902 add:

    %s   Seconds since 1970-01-01 00:00:00 UTC as a decimal number
         (see [xref to XBD 4.15 Seconds Since the Epoch])

Cross-volume changes to XSH:

After page 2009 line 63596 section strftime, add:

[CX]s    Replaced by the number of seconds since 1970-01-01 00:00:00 UTC
         as a decimal number (see [xref to XBD 4.15 Seconds Since the
         Epoch]). [all members, as if by a call to mktime()] [/CX]

After page 2027 line 64161 section strptime, add:

    s    The number of seconds since 1970-01-01 00:00:00 UTC as a
         decimal number (see [xref to XBD 4.15 Seconds Since the
         Epoch]); leading zeros shall be permitted but shall not be
         required.


Don Cragun

2009-11-05 16:52

manager   bugnote:0000283

Last edited: 2016-02-25 16:49

This bug originally added %s to the description of the date utility.
That is no longer done here because the date utility now defers to strftime()
due to changes made in response to 0000466.
Cross-volume changes to XSH:

After page 2009 line 63596 section strftime, add:

[CX]s    Replaced by the number of seconds since the Epoch
         as a decimal number (see [xref to XBD 4.15 Seconds Since the
         Epoch]). [all members, as if by a call to mktime()] [/CX]

At page 2011 line 63686 section strftime(), change:
        Otherwise, 0 shall be returned and the contents of the array are
        unspecified.
to:
        Otherwise, 0 shall be returned, <CX>errno shall be set to indicate
        the error,</CX> and the contents of the array are unspecified.

At page 2011 line 63689 section strftime(), replace the entire ERRORS section with:
       <CX>These functions shall fail if:

        [EOVERFLOW]   The format string includes a %s conversion and the
                     number of seconds since the Epoch cannot be represented
                     in a time_t.

        These functions may fail if:

        [EINVAL]   The format string includes a %s conversion and the number of
                   seconds since the Epoch would be negative.</CX>

After page 2027 line 64161 section strptime, add:

    s    The number of seconds since the Epoch as a
         decimal number (see [xref to XBD 4.15 Seconds Since the
         Epoch]); leading zeros shall be permitted but shall not be
         required.


Issue History

Date Modified Username Field Change
2009-10-15 15:44 wpollock New Issue
2009-10-15 15:44 wpollock Status New => Under Review
2009-10-15 15:44 wpollock Assigned To => ajosey
2009-10-15 15:44 wpollock Name => Wayne Pollock
2009-10-15 15:44 wpollock Section => date
2009-10-15 15:44 wpollock Page Number => NA
2009-10-15 15:44 wpollock Line Number => NA
2009-10-16 09:07 geoffclare Note Added: 0000262
2009-10-16 09:07 geoffclare Note Edited: 0000262
2009-10-16 09:12 geoffclare Note Edited: 0000262
2009-11-05 16:51 msbrown Interp Status => ---
2009-11-05 16:51 msbrown Resolution Open => Future Enhancement
2009-11-05 16:52 Don Cragun Note Added: 0000283
2009-11-05 16:54 Don Cragun Final Accepted Text => 0000169:0000283
2009-11-05 16:54 Don Cragun Status Under Review => Resolved
2010-09-09 15:47 geoffclare Tag Attached: issue8
2011-06-24 21:00 eblake Relationship added related to 0000047
2011-06-24 21:13 eblake Relationship added related to 0000466
2011-06-30 16:23 Don Cragun Note Edited: 0000283
2011-06-30 16:49 eblake Tag Attached: c99
2011-07-08 15:59 Don Cragun Resolution Future Enhancement => Accepted As Marked
2015-06-04 08:31 geoffclare Relationship added related to 0000954
2016-02-25 16:45 Don Cragun Note Edited: 0000283
2016-02-25 16:48 Don Cragun Note Edited: 0000283
2016-02-25 16:49 Don Cragun Note Edited: 0000283
2019-12-20 11:55 geoffclare Status Resolved => Applied
2024-02-26 19:54 eblake Relationship added parent of 0001612
2024-02-26 19:55 eblake Relationship added parent of 0001797
2024-06-11 08:53 agadmin Status Applied => Closed