[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: octave 2.9.13 on cygwin
From: |
Marco Atzeri |
Subject: |
Re: octave 2.9.13 on cygwin |
Date: |
Wed, 5 Sep 2007 14:16:39 +0200 (CEST) |
--- "John W. Eaton" ha scritto:
> On 30-Aug-2007, Marco Atzeri wrote:
>
> | Hi,
> | first I would like to confirm that
> | octave-2.9.13 compile fine on latest
> | cygwin snapshot 1.7.0s(0.177/4/2) 20070813
> 12:16:31.
> | Can anyone confirm it for others cygwin ?
> |
> | [tm,nc]=strptime('30-Aug-2007','%d-%b-%Y')
> | tm =
> | {
> | usec = 0
> | sec = 0
> | min = 0
> | hour = 0
> | mday = 30
> | mon = 7
> | year = 107
> | wday = 0
> | yday = 0
> | isdst = 0
> | zone = WEST
> | }
> |
> | nc = 12
> |
> | It seems a old issue not solved yet
> |
>
> Can you please debug why it fails to compute the
> correct number of
> characters on your system?
>
> jwe
>
I suspect there is a problem in the cygwin
implementation of strptime.
I built a test program around
http://www.opengroup.org/onlinepubs/009695399/functions/strptime.html
example
strptime_test.c
-----------------------------------
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
struct tm tm;
time_t t;
char *strp_time;
if (argc != 3)
{/* Handle error */;
printf("usage: %s date
date_format",argv[0]);
exit(EXIT_FAILURE);
}
if ((strp_time=strptime(argv[1], argv[2], &tm)) ==
NULL)
{/* Handle error */;
printf("ERROR: strptime NULL \n");
}
printf("year: %d; month: %d; day: %d;\n",
tm.tm_year, tm.tm_mon, tm.tm_mday);
printf("hour: %d; minute: %d; second: %d\n",
tm.tm_hour, tm.tm_min, tm.tm_sec);
printf("week day: %d; year day: %d\n", tm.tm_wday,
tm.tm_yday);
printf("strptime len: %d\n",(strp_time-argv[1])) ;
tm.tm_isdst = -1; /* Not set by strptime(); tells
mktime()
to determine whether
daylight saving time
is in effect */
t = mktime(&tm);
if (t == -1)
{/* Handle error */;
printf("ERROR: mktime \n ");
}
printf("seconds since the Epoch: %ld\n", (long) t);
}
-------------------------------------
gcc -o strptime_test strptime_test.c
$ ./strptime_test.exe '30-Aug-2007' '%d-%b-%Y'
year: 107; month: 7; day: 30;
hour: 2280452; minute: 60450; second: 0
week day: 2280680; year day: 1628394983
strptime len: 11
ERROR: mktime
seconds since the Epoch: -1
from the specification of
"RETURN VALUE
Upon successful completion, strptime() shall
return a pointer to the character following the
last character parsed. Otherwise, a null pointer
shall be returned."
It is not clear if "\n" character is to be included
or not in the parsing.
However
week day: 2280680; year day: 1628394983
are probably the cause of failing test in octave
./strptime_test.exe "6 Dec 2007 12:33:45" "%d %b %Y
%H:%M:%S"
year: 107; month: 11; day: 6;
hour: 12; minute: 33; second: 45
week day: 2280680; year day: 1628394983
strptime len: 19
seconds since the Epoch: 1196940825
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail:
http://it.docs.yahoo.com/nowyoucan.html
- Re: octave 2.9.13 on cygwin,
Marco Atzeri <=
- Re: octave 2.9.13 on cygwin, Marco Atzeri, 2007/09/05
- Re: octave 2.9.13 on cygwin, John W. Eaton, 2007/09/06
- Re: octave 2.9.13 on cygwin, Marco Atzeri, 2007/09/07
- Re: octave 2.9.13 on cygwin, Tatsuro MATSUOKA, 2007/09/07
- Re: octave 2.9.13 on cygwin, Tatsuro MATSUOKA, 2007/09/10
- Re: octave 2.9.13 on cygwin, Marco Atzeri, 2007/09/10
- Re: octave 2.9.13 on cygwin, John W. Eaton, 2007/09/10
- Re: octave 2.9.13 on cygwin, Tatsuro MATSUOKA, 2007/09/10
- Re: octave 2.9.13 on cygwin, Marco Atzeri, 2007/09/10
- Re: octave 2.9.13 on cygwin, Tatsuro MATSUOKA, 2007/09/11