Re: Problem with DateTime::Format::DateManip v0.01

2003-09-05 Thread David Wheeler
On Thursday, September 4, 2003, at 09:37  PM, Dave Rolsky wrote:

I'm pretty sure you have to do that.  For example, if you simply set
$ENV{TZ} then localtime() doesn't change in this script:
 perl -le 'print scalar localtime; $ENV{TZ} = Asia/Tokyo; print 
scalar localtime'

But in this one it does

 perl -MPOSIX -le 'print scalar localtime; $ENV{TZ} = Asia/Tokyo; 
POSIX::tzset(); print scalar localtime'
Damn, okay, thanks.

Can you do another test for me (since I don't have a platform that 
needs tzset)? Can you tell me how it affects use of local? Here's a 
test script:

#!/usr/bin/perl -w
use strict;
use POSIX qw(tzset);
print scalar localtime, $/;
{
local $ENV{TZ} = Asia/Tokyo;
tzset;
print scalar localtime, $/;
}
print scalar localtime, $/;
The question is, what does the third print statement print? Do I need 
to call tzset again after the block?

TIA,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://www.kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]


Re: Problem with DateTime::Format::DateManip v0.01

2003-09-05 Thread David Wheeler
On Friday, September 5, 2003, at 12:50  AM, Joshua Hoblitt wrote:

So there is a difference, on some platform(s), between inheriting the 
value of TZ from the environment and setting it at runtime.  Using 
tzset() is the 'portable' thing to do.
Okay, thanks.

Didn't I answer an almost identical question from David a few months 
ago?
Possibly. I had reported an issue with TZs not appearing to work on 
Debian, but if you said exactly the above, I missed it. Sorry. I'm glad 
to have the information now!

Cheers,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://www.kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]


Re: Problem with DateTime::Format::DateManip v0.01

2003-09-05 Thread Dave Rolsky
On Fri, 5 Sep 2003, David Wheeler wrote:

 Can you do another test for me (since I don't have a platform that
 needs tzset)? Can you tell me how it affects use of local? Here's a
 test script:

 #!/usr/bin/perl -w
 use strict;
 use POSIX qw(tzset);

 print scalar localtime, $/;
 {
  local $ENV{TZ} = Asia/Tokyo;
  tzset;
  print scalar localtime, $/;
 }
 print scalar localtime, $/;

 The question is, what does the third print statement print? Do I need
 to call tzset again after the block?

Yep, you need to call it again.  Whatever tzset does is something at a C
library level, not a Perl level, so the localization doesn't do anything.


-dave

/*===
House Absolute Consulting
www.houseabsolute.com
===*/


Re: Problem with DateTime::Format::DateManip v0.01

2003-09-05 Thread Dave Rolsky
On Fri, 5 Sep 2003, David Wheeler wrote:

 Bah. Thanks for that. Does this work?

 #!/usr/bin/perl -w

 use strict;
 use POSIX qw(tzset);
 print scalar localtime, $/;
 {
  local $ENV{TZ} = Asia/Tokyo;
  tzset;
  print scalar localtime, $/;
 }
 tzset;
 print scalar localtime, $/;

yup


/*===
House Absolute Consulting
www.houseabsolute.com
===*/


Problem with DateTime::Format::DateManip v0.01

2003-09-04 Thread Jonathan Leffler
Hi,

Thanks to Eugene for fixing up a new release of
DateTime::Calendar::Pataphysical - that works (for me, anyway).

I'm having consistent problems with DateTime::Format::DateManip v0.01,
on both Solaris 8 and MacOS X 10.2.6 with Perl 5.8.1.

Extracting DateTime-Format-DateManip-0.01/README
Running [/usr/perl/v5.8.1/bin/perl Build.PL]...
Checking whether your kit is complete...
Looks good
Creating new 'Build' script for 'DateTime-Format-DateManip' version '0.01'
Running [/usr/perl/v5.8.1/bin/perl Build UNINST=1]...
*** ERROR: unterminated C... at line 313 in file 
blib/lib/DateTime/Format/DateManip.pm
lib/DateTime/Format/DateManip.pm - blib/lib/DateTime/Format/DateManip.pm
Manifying blib/lib/DateTime/Format/DateManip.pm - 
blib/libdoc/DateTime::Format::DateManip.3
Running [/usr/perl/v5.8.1/bin/perl Build UNINST=1 test]...
t/00load...ok
t/01conversions# Failed test (t/01conversions.t at line 69)
#  got: '2003032300:00:00'
# expected: '2003032303:00:00'
# Failed test (t/01conversions.t at line 69)
#  got: '2003032312:00:00'
# expected: '2003032315:00:00'
# Looks like you failed 2 tests of 6.
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 3-4
Failed 2/6 tests, 66.67% okay
Failed Test   Stat Wstat Total Fail  Failed  List of Failed

t/01conversions.t2   512 62  33.33%  3-4
Failed 1/2 test scripts, 50.00% okay. 2/7 subtests failed, 71.43% okay.

I don't know if it is significant that I'm running in US/Pacific time
zone, which is 3 hours adrift from US/Eastern - it doesn't seem to be
that simple as running with TZ=US/Eastern does not alter the answers.


-- 
Jonathan Leffler   #include disclaimer.h
STSM, Informix Database Engineering, IBM Data Management
Phone: +1 650-926-6921   Fax: +1 650-926-6971   Tie-line: 630-6921
Email: [EMAIL PROTECTED]
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org


Re: Problem with DateTime::Format::DateManip v0.01

2003-09-04 Thread Dave Rolsky
On Thu, 4 Sep 2003, Jonathan Leffler wrote:

 I don't know if it is significant that I'm running in US/Pacific time
 zone, which is 3 hours adrift from US/Eastern - it doesn't seem to be
 that simple as running with TZ=US/Eastern does not alter the answers.

It's probably that simple.  Simply setting the TZ env var probably won't
do much.  An app has to call POSIX::tzset() for that take effect.


-dave

/*===
House Absolute Consulting
www.houseabsolute.com
===*/


Re: Problem with DateTime::Format::DateManip v0.01

2003-09-04 Thread Dave Rolsky
On Thu, 4 Sep 2003, Dave Rolsky wrote:

 On Thu, 4 Sep 2003, Jonathan Leffler wrote:

  I don't know if it is significant that I'm running in US/Pacific time
  zone, which is 3 hours adrift from US/Eastern - it doesn't seem to be
  that simple as running with TZ=US/Eastern does not alter the answers.

 It's probably that simple.  Simply setting the TZ env var probably won't
 do much.  An app has to call POSIX::tzset() for that take effect.

I take it back.  The real problem is that Date::Manip doesn't parse time
zone offsets when given an ical format datetime.


-dave

/*===
House Absolute Consulting
www.houseabsolute.com
===*/


Re: Problem with DateTime::Format::DateManip v0.01

2003-09-04 Thread David Wheeler
On Thursday, September 4, 2003, at 12:53  PM, Dave Rolsky wrote:

It's probably that simple.  Simply setting the TZ env var probably 
won't
do much.  An app has to call POSIX::tzset() for that take effect.
I find that for most date and time handling I do, just setting $ENV{TZ} 
does the trick -- except perhaps on Debian. Are you saying that if I 
want the setting of TZ to portably affect, e.g., localtime, that I need 
to always POSIX::tzset() after I do it? Seems a waste to load all of 
POSIX.pm just for that...

Cheers,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED]  ICQ: 15726394
http://www.kineticode.com/ Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]