Skip to content
Prev 2527 / 63424 Next

date() should not append a final "\n" ?!?

MM> Between R 0.63.2 and 0.64, the behavior of 
MM> date()
MM> has been changed in order to become platform independent.
MM> It now uses POSIX calls, basically

MM> time_t t;
MM> time(&t);
MM> return ctime(&t);


MM> This currently returns (for me on Sun SPARC Solaris)
MM> [1] "Thu Aug 19 10:36:28 1999\n"

MM> where I think the final "\n" is really UNdesired.

FrL> Yes!
KH> Be brutal, do

KH> date <- function() substring(.Internal(date()), 1, 24)
But you did not define `elegant' ... :-)
Define `correct'.  That would be without the trailing newline?
Suggestion:

	return strtok(ctime(&t), "\n");

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._