Re: Re: Strptime issues

2003-11-06 Thread rickmeasham
 Flavio S. Glock [EMAIL PROTECTED] wrote: 
  
 How about to extend the 'to_datetime' method, 
instead of creating a 
 new 
 one: 
  
if ($dti-can_be_datetime) { 
   $dti = $dti-to_datetime 
} 
  
 
Sounds good .. and it's as simple as using 
DateTime-today as the base, which may well be a 
good default behaviour for -to_datetime when no 
base is in the object or none is passed in the call. 
 
Cheers! 
Rick 


Re: Re: Re: Strptime issues

2003-11-04 Thread rickmeasham
 [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote: 
 sub has_time { $_[0]-has{'hour', 'minute'} }   
 
Maybe should be: 
sub has_time {  
   return 1 if ($_[0]-has('hour', 'minute') and not 
$_[0]-has('nanosecond')); 
   return 1 if ($_[0]-has('hour', 'minute', 'second'))  
   return 0 
}   
Which only returns true if we have HH:MM or 
HH:MM:SS or HH:MM:SS.N+. The older version 
allowed us to get true for HH:MM:xx.N+ which is not 
really a time. 
 
Same caveat: 
Above code passes all tests on the perl installed in
my head. Havn't tried any of it with the much fussier  
software version.   
   
perl -v   
This is perl, v5.8.0 built for ricks-brain-1.0   
   
   
 


Re: Re: Strptime issues

2003-11-03 Thread rickmeasham
 David Hood [EMAIL PROTECTED] wrote: 
 Perhaps you should return only the information that 
is given, in an 
 iso 8601 
 compliant format, so for November 2003 you could 
simply return 
 2003-11. The 
 
Nah, that's not going to happen. The entire point of 
the module is to get a DateTime object. So it's either 
going to be a full DateTime or a 
DateTime::Incomplete. 
 
Also: What's the ISO format for 11pm November? 


Re: [RFC] DateTime::Bundle::Minimal and DateTime::Bundle::Basic

2003-10-22 Thread rickmeasham
 
 
 
 
 Dave Rolsky schreef: 
  DateTime, it will tell you that you need these 
prereqs anyway. 
 
Eugene van der Pijll [EMAIL PROTECTED] wrote: 
 The first few versions of Bundle::DateTime left out 
those prereqs. 
 As a result, the bundle was difficult to install for the 
first time: 
 
A good point Dave, so there's really no need for 
Bundle::DateTime::Minimal, as you get the same thing 
by just installing DateTime with CPAN. 
 
So then we're left with the other bundle, which Eugene 
has suggested calling Bundle::DateTime, and moving 
the existing bundle to Bundle::DateTime::Complete. 
 
That sounds like a good idea, however I'm not sure 
about including DT::F::Mail and DT::F::HTTP. They 
seem to be fairly specific-task oriented modules. 
 
I admit that they're probably common tasks, but if I 
wanted a quick way to get up and going with 
DateTime, but it was for DBI, I'd be annoyed that I 
was getting net-related modules. 
 
I'm open to including them, just a little disinclined. 
 
Cheers! 
Rick 
 
P.S. Eugene: as you point out, you need to include all 
prerequisites in the bundle. It also seems that the 
order is of the utmost importance. I had to install the 
current bundle at least four times before it got 
everything installed. I wondered if that could be 
because it installs the modules in the order in the file 
rather than downloading them all and checking 
prereq's first. On the other hand I seem to recall 
CPAN.pm didn't fully install before it went on to the 
next one.. maybe I have an old CPAN. 
 
Cheers more! 
Rick 


Re: Re: FW: DateTime questions...

2003-10-18 Thread rickmeasham
 
 
 
 
 Matt Wright [EMAIL PROTECTED] wrote: 
 Yes, I noticed this too, but there seemed to be quite 
a few problems 
 besides 
 just the compiler issue.  The Makefile came out 
very screwy as well, 
 with a 
 lot of missing single quotes, variables without any = 
signs after 
 them, etc. 
 
 
I had this problem with RH9 also  ...  seems that perl's 
Unicode and RH9's Unicode support got all tangled 
up. I fixed it by changing LANG=en_US in my bashrc 
to just 'LANG='. I read that somewhere ... anyway it 
works! I think perl downgraded it's unicode for 5.8.1 
because of this. I can't remember it's a while since I 
researched it. You might want to search perl port. 
 
Cheers! 
Rick 


Re: Re: Olson - Microsoft mappings

2003-09-24 Thread rickmeasham
Michael Fair [EMAIL PROTECTED] wrote:
 For instance, So what's the time in Ireland?
 Do you use Europe/Dublin or
Europe/Belfast?  What's the
 difference?
 Do you expect the end user to know that
Dublin and Belfast are in
 Ireland
 before they can see the time in Ireland?

This is a bit of a beef I have (as of earlier
today) with the Olson project. I've managed
to auto-map about 174 of the olson zones to
geographic places but am scared I may have to
do the rest by hand. I wish the names were
more along the lines of:
Oceania/Australia/Melbourne-Victoria
Rather than
Australia/Melbourne

Once I've completed my research we should have:
$time_zone{$continent}{$country}{$region} and/or
$time_zone{$continent}{$country}{$city}

I figure we should allow access to the data
such that we can get a list that looks like:
Oceania
  - Australia
- Melbourne (Victoria)

It would probably be good to create
DateTime::TimeZone::Select to hold this data,
and then DateTime::TimeZone::Select::HTML and
DateTime::TimeZone::Select::Tk and
DateTime::TimeZone::Select::Terminal for
holding widgets for people to just drop in place.


Re: RE: figuring out the number of sundays in a given year

2003-09-21 Thread rickmeasham
Jerry Wilcox [EMAIL PROTECTED] wrote:
 I'm not sure about the count in a year, but
I frequently need to 
 determine how many of a given day of the
week fall in a given month 
 of the year, or, more precisely, given that
today is Saturday, 
 September 20, I need to figure out whether
today is the first, 
 second, third, fourth, or fifth Saturday of
the month. I've worked 
 out code using existing methods to tell me
what I need to know, and 
 I'm not sure that an entirely new method is
warranted here.

Jerry: There's two functionality in the above.

First: How many of a particular DOW are in a
period. This is just a matter of dividing the
total days by seven then adding one if
needed. If a function were added for this,
then I imagine its more a part of
DateTime::Span rather than DateTime itself.

Secondly you ask about getting the weekday of
the month. There's already a function in
DateTime for this:
$dt-weekday_of_month();

Test it with this:
perl -MDateTime -e 'print DateTime-new( year
= 2003, month = 9, day =
20)-weekday_of_month()'



Re: Re: [rfc] HiRes

2003-08-02 Thread rickmeasham
 Dave Rolsky [EMAIL PROTECTED] wrote:
 I take it back.  I thought we'd have now() and hires_now().  I think
 having nanosecond at 0 makes sense to most people.

Hang on, before we go any further and before code exists can I point out that we 
should have high_res_now() or now_high_res() or now(high_res=1) rather 
than 'hires' which looks like the past tense of the verb to 'hire'. At all other times 
in 
DateTime we've made sure not to abbreviate, but high_resolution_now() is too 
cumbersome :)

Mainly don't go with hires even though a 'famous' module already does.

Cheers!
Rick