Greetings.
I'm a big fan of the DateTime modules, but I'm having some trouble with
the DateTime::Format::ISO8601 parse_time() function.
The problem I'm having is that I'm in UTC-0500 (US Eastern Time Zone) but
the parse_time function assumes I'm working in UTC. So if the current
date/time is 2021-01-03 20:00 in my local time zone, then parse_time is
working off of a base of 2021-01-04 01:00 . Since parse_time does not
take a date, only a time, then the resulting object is off by a day.
I am aware that DateTime::Format::ISO8601->new() takes an optional
"base_datetime" , but when I try to set this:
$base = DateTime->now()->set_time_zone("America/New_York");
$date = DateTime::Format::ISO8601 -> new ( base_datetime => $base )
->parse_time( "1955" );
I end up in an infinite loop.
brk(0x2808000) = 0x2808000
brk(0x2829000) = 0x2829000
brk(0x284a000) = 0x284a000
brk(0x286b000) = 0x286b000
brk(0x288c000) = 0x288c000
brk(0x288b000) = 0x288b000
brk(0x28ac000) = 0x28ac000
brk(0x28cd000) = 0x28cd000
brk(0x28ee000) = 0x28ee000
brk(0x28ed000) = 0x28ed000
[...]
Is there something that I can do to force DateTime::Format::ISO8601's
parse_time() function to do what I want -- use the local time zone as
its base for the unspecified date?
(Reminder, for those of you willing to test and help -- the problem only
exists when the **current time** is between midnight-UTC and midnight-local,
**not** the time provided to the parse_time function.)
Thanks.
--hymie!
http://nasalinux.net/~hymie hy...@nasalinux.net