Subject: | OS X 10.5 PPC strptime issue |
OS X 10.5.8 PPC appears to have a problem with strptime (but 10.6 on Intel appears fine).
This code fails:
Time::Piece->strptime( '20000601120000', '%Y %m %d %H %M %S' );
This code works:
Time::Piece->strptime( '2000 0601120000', '%Y %m %d %H %M %S' );
I'd expect both to succeed.
Note that the attached C snippet fails when MACOSX_DEPLOYMENT_TARGET is unset or set to
10.5, but succeeds when set to 10.3 or 10.4. I can't seem to get the correct behavior out of
the Time::Piece module with any combination of flags/env vars.
Thanks for any help.
uname: Darwin rerun.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT
2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh
Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
Platform:
osname=darwin, osvers=9.8.0, archname=darwin-2level
uname='darwin rerun.local 9.8.0 darwin kernel version 9.8.0: wed jul 15 16:57:01 pdt
2009; root:xnu-1228.15.4~1release_ppc power macintosh '
config_args='-d'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include',
optimize='-O3',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-
strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.0.1 (Apple Inc. build 5465)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -
L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-
protector'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO
Built under darwin
Compiled at Nov 14 2009 07:08:37
@INC:
/usr/local/lib/perl5/5.10.1/darwin-2level
/usr/local/lib/perl5/5.10.1
/usr/local/lib/perl5/site_perl/5.10.1/darwin-2level
/usr/local/lib/perl5/site_perl/5.10.1
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
.
Subject: | time.c |
#include <time.h>
#include <stdio.h>
int main () {
char * string = "19990601120030";
char * informat = "%Y %m %d %H %M %S";
struct tm mytm;
time_t t;
char * remainder;
t = 0;
mytm = *gmtime(&t);
remainder = (char *) strptime(string, informat, &mytm);
if (remainder == NULL)
printf("Null Remainder\n");
else
printf("Parsed Correctly\n");
}