Error in datestr.m in Octave-3.2.0 MingW
John W. Eaton
jwe at octave.org
Mon Jun 22 12:47:36 CDT 2009
On 22-Jun-2009, Philip Nienhuis wrote:
| Octave's function datestr.m fails for dates before Jan 2, 1970 in the
| MingW build 3.2.0:
|
| **********************<screen copy:>*********************************
|
| GNU Octave, version 3.2.0
| Copyright (C) 2009 John W. Eaton and others.
| This is free software; see the source code for copying conditions.
| There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
| FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
|
| Octave was configured for "i686-pc-mingw32".
|
| Additional information about Octave is available at http://www.octave.org.
|
| Please contribute if you find this software useful.
| For more information, visit http://www.octave.org/help-wanted.html
|
| Report bugs to <bug at octave.org> (but first, please read
| http://www.octave.org/bugs.html to learn how to write a helpful report).
|
| For information about changes from previous versions, type `news'.
|
| warning: mark_as_command is obsolete and will be removed from a future
| version of Octave
| octave-3.2.0 > datestr(datenum(1970, 1, 1))
| ans = 00-Jan-1900
| octave-3.2.0 > datestr(datenum(1970, 1, 2))
| ans = 02-Jan-1970
| octave-3.2.0 >
|
| **********************</screen copy>*********************************
|
| The previous 3.0.3 VC++ Windows build is OK in this respect.
|
| I haven't checked other binary octave versions yet.
|
| While perusing the source code of datestr.m I couldn't find the spot
| where the actual conversion takes place (but then again I'm neither an
| octave nor a C++ guru).
| (Speculation (sorry): I suspect the use of strftime() may be related to
| this.)
Yes, it uses strftime. It seems to work for me on my Debian system:
octave:1> datestr(datenum(1970, 1, 1))
ans = 01-Jan-1970
octave:2> datestr(datenum(1969, 1, 1))
ans = 01-Jan-1969
octave:3> datestr(datenum(1929, 1, 1))
ans = 01-Jan-1929
I guess strftime is broken on MinGW? I think the proper place to fix
that is in the MinGW C library.
jwe
More information about the Bug-octave
mailing list