bugGNU Octave - Bugs: bug #45976, ctime and asctime add a trailing...

 
 

bug #45976: ctime and asctime add a trailing newline character to the return value

Submitted by:  None
Submitted on:  Wed 16 Sep 2015 10:41:20 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Documentation
Status: FixedAssigned to: None
Originator Name: T HerzkeOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sun 20 Sep 2015 09:29:58 AM UTC, comment #6:

Fixed on the stable branch:

http://hg.savannah.gnu.org/hgweb/octave/rev/635c93bba6b6

Mike Miller <mtmiller>
Project Administrator
Sun 20 Sep 2015 07:24:48 AM UTC, comment #5:

Regarding the previous comment:

There is/should be a literal backslash between the 2015 and the n in the result example. It's displayed as such on the web bug tracker,but missing from the email that I received after comment submission.

T Herzke

Anonymous
Sun 20 Sep 2015 07:19:34 AM UTC, comment #4:

As a user, I'd like to see

ctime (time ())
=> "Sun Sep 20 08:54:28 2015\n"

being displayed with the double quotes when I invoke e.g. help ctime, or doc ctime.

The meaning of backslash-n is clear enough to me as a casual octave user, even though I was not aware of the exact difference between single-quoted vs. double-quoted strings regarding escape sequences before reporting this issue.

Now how that backslash might need to be escaped in the source to be displayed correctly in the output of help / doc is something I do not know.

T Herzke

Anonymous
Sat 19 Sep 2015 10:14:10 PM UTC, comment #3:

Any thoughts on how to represent that? I don't see any existing examples of @result{} showing a string containing a newline. Keep the @result{} as is, just note the trailing newline in the text?

Maybe we should update to a new example timestamp also ;)

Mike Miller <mtmiller>
Project Administrator
Wed 16 Sep 2015 12:12:13 PM UTC, comment #2:

Both of these functions are patterned after the C library functions of the same name. The C library version of asctime is explicitly documented to include a trailing newline in the result. I think we should just fix the Octave documentation to make that clear.

John W. Eaton <jwe>
Project Administrator
Wed 16 Sep 2015 11:41:12 AM UTC, comment #1:

I can confirm this behavior w Octave-4.1.0+ on Windows:

Release -> dev, OS -> Any

Philip Nienhuis <philipnienhuis>
Project Member
Wed 16 Sep 2015 10:41:20 AM UTC, original submission:

The functions "ctime" and "asctime" return a string representation of the time argument.

The documentation of both functions suggests that there will be neither leading nor trailing white space. Documentation excerpt:

ctime (time ())
=> "Mon Feb 17 01:15:06 1997"

However, the return value contains a newline as the last character.

Either the functions should be modified to not append the newline character, or the documentation should be altered to indicate that the return values will end in a newline.

To my knowledge, matlab does not implement these functions, so matlab compatibility should not be a concern in resolving this issue.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 20 Sep 2015 09:29:58 AM UTCmtmillerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 16 Sep 2015 05:29:02 PM UTCrik5Item GroupIncorrect Result=>Documentation
    Wed 16 Sep 2015 11:41:12 AM UTCphilipnienhuisStatusNone=>Confirmed
      Release4.0.0=>dev
      Operating SystemGNU/Linux=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1