[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 197
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970 |
Date: |
Fri, 24 Sep 2010 17:04:57 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100819 Iceweasel/3.5.11 (like Firefox/3.5.11) |
Follow-up Comment #8, bug #31079 (project octave):
I think the gnulib mktime tests don't check whether dates before the epoch
can be handled.
Since you have a glibc-based system, I'm not sure why you see results that
are different from what I see. On my system, I get the following results:
octave3.2:2> tm = localtime (time)
tm =
{
usec = 135222
sec = 41
min = 57
hour = 12
mday = 24
mon = 8
year = 110
wday = 5
yday = 266
isdst = 1
zone = EDT
}
octave3.2:3> tm.year = -23
tm =
{
usec = 135222
sec = 41
min = 57
hour = 12
mday = 24
mon = 8
year = -23
wday = 5
yday = 266
isdst = 1
zone = EDT
}
octave3.2:4> mktime (tm)
ans = -2.9117e+09
octave3.2:5> localtime (mktime (tm))
ans =
{
usec = -864778
sec = 42
min = 57
hour = 12
mday = 24
mon = 8
year = -23
wday = 1
yday = 266
isdst = 0
zone = LMT
}
So mktime just generates negative values for dates before the epoch and
localtime converts those back to a time structure. But there are apparently
some strange things happening because we don't exactly recover the original
time structure.
If the C library time functions are worthless, then what are we supposed to
do? I don't think we should be inventing a date/time library just for Octave.
If we are going to write something like that, I think it should be a gnulib
module that could be used by more than just Octave.
Or, is there something that already exists to do the job? Surely Octave is
not the only program that needs functionality like this.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31079>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, J-D Bonjour, 2010/09/19
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, Philip Nienhuis, 2010/09/20
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, John W. Eaton, 2010/09/20
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, Ben Abbott, 2010/09/21
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, John W. Eaton, 2010/09/22
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, Ben Abbott, 2010/09/22
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, Philip Nienhuis, 2010/09/24
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, Philip Nienhuis, 2010/09/24
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970,
John W. Eaton <=
- [Octave-bug-tracker] [bug #31079] DATESTR function buggy before year 1970, Philip Nienhuis, 2010/09/24