Re: time_zone and DateTime::Format::Strptime

2009-12-17 Thread Olivier Mengué
2009/12/14 Kevin McGrath kmcgr...@baknet.com The time_zone function in DateTime::Format::Strptime is only called with parse_datetime. I think a nice feature would be to also set the time_zone when calling format_datetime. Keep in mind that DateTime::Format is a framework, and consistency

Re: time_zone and DateTime::Format::Strptime

2009-12-16 Thread Kevin McGrath
There is nothing I want to do with parse_datetime. parse_datetime works great and nothing I have said suggests that anything different should happen when parsing a string to a datetime object. Everything about parse_datetime, reading of a string and setting of a time_zone works exactly how

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Bill Moseley
On Tue, Dec 15, 2009 at 5:28 AM, Kevin McGrath kmcgr...@baknet.com wrote: Doing the work in parse_datetime does not work for me. In fact I almost never call parse_datetime directly and when I do it's to get the datetime passed in from a form into UTC. I need/want the time_zone conversion to

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
That is an option, just thought that since DateTime::Format::Strptime already provides a function for time_zone it would make sense for all things parsed or formatted be done in respect to that time_zone. Like I said I already have a class that takes care of this, my own subclass of

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Evan Carroll
On Tue, Dec 15, 2009 at 7:28 AM, Kevin McGrath kmcgr...@baknet.com wrote: Here is my situation.  I use the Rose Framework as my ORM under mod_perl, fast_cgi, and server_side scripts.  I have the framework set up to use UTC to store all datetimes.  I do all work in my controllers in UTC time. 

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
I know traditional convention does not account for this. That is why I was merely suggesting a 'format_with_time_zone' option you could pass to the new constructor. DateTime::Format::Strptime already takes time_zone as a parameter. Why should you have the set the time zone as an extra step

RE: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Metz, Bobby
I like the new option idea Kevin proposes. Seems more straightforward. Just my 2 cents... B -Original Message- From: Kevin McGrath [mailto:kmcgr...@baknet.com] Sent: Tuesday, December 15, 2009 2:23 PM To: Evan Carroll Cc: datetime@perl.org Subject: Re: time_zone and DateTime

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Evan Carroll
Basically I have a subclass of DateTime::Format::Strptime that takes one more parameter; a boolean that if true will format the datetime object with what is returned from time_zone. This sounds like a bad idea, because you made note that you're doing this on format_datetime, time_zone by

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
I guess I'm just not very good at explaining the feature. If I have a formatter that is related to a time_zone then I feel that input and output of that formatter should be able to be based on that time zone. my $Strp = new DateTime::Format::Strptime( pattern = '%T', locale = 'en_AU',

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Evan Carroll
On Tue, Dec 15, 2009 at 3:39 PM, Kevin McGrath kmcgr...@baknet.com wrote: I guess I'm just not very good at explaining the feature.  If I have a formatter that is related to a time_zone then I feel that input and output of that formatter should be able to be based on that time zone. The

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
On Tue, Dec 15, 2009 at 5:01 PM, Evan Carroll m...@evancarroll.com wrote: On Tue, Dec 15, 2009 at 3:39 PM, Kevin McGrath kmcgr...@baknet.com wrote: I guess I'm just not very good at explaining the feature. If I have a formatter that is related to a time_zone then I feel that input and

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
On Tue, Dec 15, 2009 at 6:51 PM, Evan Carroll m...@evancarroll.com wrote: Why then does parse_datetime automatically convert from a string to a timezone? Shouldn't it then just always return a datetime in floating context? It doesn't convert it reads it as. my $dt =

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
Maybe that's what I'm really looking for. I originally thought it was a minor change that fit well within the parameters of the current module, but I'm open to ideas. -Kevin On Tue, Dec 15, 2009 at 5:25 PM, Jim Monty jim.mo...@yahoo.com wrote: How about an entirely new, high-level abstraction

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Evan Carroll
But the difference is I'm not really adding functionality, and nothing is happening under the hood to the DateTime object, just a new value will be supplied to the DateTime constructor. I guess I still don't see how: $Strp-format_datetime( $str, { time_zone = $tz1 } );

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Kevin McGrath
On Tue, Dec 15, 2009 at 11:39 PM, Evan Carroll m...@evancarroll.com wrote: How much would you want to be overridable, and set in the constructor of the DateTime::Format module? Just the format_datetime function when it comes to the value which is assigned to the time_zone attribue. It's

Re: time_zone and DateTime::Format::Strptime

2009-12-15 Thread Evan Carroll
Just the format_datetime function when it comes to the value which is assigned to the time_zone attribue.  It's already an attribute of the module. I simply /do not/ believe you understand the difference between being 1:30 read-in the context of America/Chicago, and converting it with

Re: time_zone and DateTime::Format::Strptime

2009-12-14 Thread Evan Carroll
If I understand you right, I have a framework that does this for you: DateTimeX::Format. And, a module for it DateTimeX::Format::Strptime - it permits you to override all of the environment in runtime, and it doesn't use a perl-rewrite of strptime, instead it uses the POSIX binding. use