Error in datestr.m in Octave-3.2.0 MingW
Philip Nienhuis
pr.nienhuis at hccnet.nl
Tue Jun 23 16:41:02 CDT 2009
John W. Eaton wrote:
> On 23-Jun-2009, Michael Goffioul wrote:
>
> | On Tue, Jun 23, 2009 at 9:30 PM, Michael
> | Goffioul<michael.goffioul at gmail.com> wrote:
> | > On Tue, Jun 23, 2009 at 9:22 PM, John W. Eaton<jwe at octave.org> wrote:
> | >> OK. Does the generated config.h file for Octave define HAVE_STRFTIME?
> | >> You can also look at the output of
> | >>
> | >> octave_config_info ("DEFS")
> | >>
> | >> If HAVE_STRFTIME is not defined on these systems, then the bug is
> | >> likely in the strftime.c that is part of Octave. Maybe we need to
> | >> find a newer version.
> | >
> | > (current archive build, with MSVC)
> | >
> | > octave:4> strfind(octave_config_info ("DEFS"), 'STRFTIME')
> | > ans = [](1x0)
> |
> | However,
> |
> | octave:8> datestr(datenum(1970, 1, 1))
> | ans = 01-Jan-1970
> | octave:9> datestr(datenum(1970, 1, 2))
> | ans = 02-Jan-1970
>
> I would expect anything on or after 1-1-1970 to work. <snip>
You mean: AFTER 1 Jan 1970 (>719529). Currently, the datestr.m of Octave
3.2.0 MingW fails for all dates BEFORE 2 Jan 1970 (see my original bug
report).
Are you really sure that strftime() is buggy? Comparing the datestr.m
files of octave versions 3.0.3 and 3.2.0 I see lots of changes.
Digging a bit further, and echoeing strftime's arguments, i.e. variable:
- df
and expression:
- localtime(mktime(tm))
in the erroneous datestr.m, I see:
*******************************<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.exe:1 > date_str(datenum(1970,1,1))
df = %d-%b-%Y
ans =
{
usec = 0
sec = 0
min = 0
hour = 0
mday = 0
mon = 0
year = 0
wday = 0
yday = 0
isdst = 0
zone = unknown
}
ans = 00-Jan-1900
octave-3.2.0.exe:2 > date_str(datenum(1970,1,2))
df = %d-%b-%Y
ans =
{
usec = 0
sec = 0
min = 0
hour = 0
mday = 2
mon = 0
year = 70
wday = 5
yday = 1
isdst = 0
zone = W. Europe Standard Time
}
ans = 02-Jan-1970
octave-3.2.0.exe:3 >
*******************************</Screen copy>********************
The same happens in the VC++ octave-3.0.3 Windows version.
I conclude that the arguments for the call to strftime() are in error.
Intriguing is that it only seems to happen on Windows.
Philip
More information about the Bug-octave
mailing list