Re: [Kinda OT] Could somebody double check this?

2003-10-13 Thread Daisuke Maki
Okay, so now I've done a bit of tweaking to my solar longitude 
calculations, and I'm now off 0.99 degrees on average from Calendrical 
Calculations book (And you'll also notice an overflow problem somewhere 
in the middle)

[EMAIL PROTECTED] lib]$ perl test.pl
  Gergorian Date | R.D |  Sol-Lgtd. | Sol-Lgtd (table) |
 -586/07/25 12:00:00 | -214193 | 120.448974 | 119.47497500 |
 -168/12/06 12:00:00 |  -61387 | 255.278332 | 254.25239000 |
   70/09/25 12:00:00 |   25469 | 182.439580 | 181.43526000 |
  135/10/03 12:00:00 |   49217 | 189.669351 | 188.66209300 |
  470/01/09 12:00:00 |  171307 | 290.109198 | 289.08940300 |
  576/05/21 12:00:00 |  210155 |  60.078742 |  59.11935700 |
  694/11/11 12:00:00 |  253427 | 229.336324 | 228.31649800 |
 1943/10/08 12:00:00 |  709580 |   0.00 | 193.34789200 |
 1992/03/18 12:00:00 |  727274 | 358.150581 | 357.15126300 |
 2094/07/19 12:00:00 |  764652 | 117.398592 | 116.43930100 |
However, I found this site: http://www.moshier.net/aadoc.html.
When I ran this program and got the number for the Sun, most of my 
calculations were within 0.05 degrees difference! So now I'm trying to 
decide who to trust...

Does anybody know if there's a good table/calculator for this kind of 
numbers that I can use to check my results? I'm also looking one for 
lunar longitudes (I've written lunar_longitude() as well, but that's 
about 13 degrees off from Calendrical Calculations :(

--d




RE: [Kinda OT] Could somebody double check this?

2003-10-13 Thread Hill, Ronald

Hi Maki,

[snipped]

[Ronald Hill Wrote] 
> > This is correct, there was talk of doing this however, it 
> > is not easy. The last I heard, there was work on getting 
> > the SLA library released under the LGPL. 
> > (hopefully this will include a windows port of the library)
> > This library has all of the functions needed for lunisolar 
> > calenders.
> 
[Maki Daisuke Wrote]
> Is this going to happen anytime soon, or is it just an idea floating 
> around? If it's going to take a while, I might just go ahead 
> and take a stab at it anyway.
> 
> --d

I have no idea how long this will take. I just checked my archives
and it seems that the SLALIB is lgpl'ed (fortran version only).
The only problem with this is that not many people have a fortran compiler
for windows :(

Anyway, I think you should take a stab at it. I did at one time create
a sun position perl module ( I was working with Henry Sobotka on this)
However, I have not done any work on it for quite some time.

I hope this helps.

Ron Hill


Re: "Calculate down time"

2003-10-13 Thread Flavio S. Glock
The right answer is "use DateTime::Business::xxx"
Now how about:

  sub no_holiday {
return $_[0] unless  ... # lookup holidays 
return undef;
  }

  my $prime_set = DateTime::SpanSet->from_set_and_duration( 
set => DT::E::Recurrence->weekly(
  days => [1..5], hours => 8 )->iterate( \&no_holiday ),
hours => 11 );

  my $duration = $prime_set->intersection( $downtime_set )->duration;

- Flavio S. Glock


Ben Bennett wrote:
> 
> Why do you hate me :-)
> 
> I have no idea how to handle this easily... is a bunch of sets the
> right answer?  Seems gross.
> 
>-ben
> 
> On Mon, Oct 13, 2003 at 01:00:09PM -0300, Flavio S. Glock wrote:
> > How about a question for the FAQ?
> >
> > http://perlmonks.org/index.pl?node_id=298788
> > >
> > > Calculate down time of devices in prime time (only working hours, excluding 
> > > p_holidays)
> > >  by albertc on Oct 13, 2003 at 05:00 GMT+3
> > >
> > > I have up & down datetime data for devices, I need a function that will provide 
> > > the
> > > downtime within the primetime period. Input will be d_time, u_time, stime 
> > > (starting time
> > > for Primetime, 08:00:00), etime (endtime for PrimeTime, 18:59:59). The function 
> > > also
> > > needs to remove downtime that occured on a public holiday and over weekends! 
> > > Public
> > > holidays will be read from mysql table with Datetime record of each public 
> > > holiday.


Re: "Calculate down time"

2003-10-13 Thread Ben Bennett
Why do you hate me :-)

I have no idea how to handle this easily... is a bunch of sets the
right answer?  Seems gross.

   -ben

On Mon, Oct 13, 2003 at 01:00:09PM -0300, Flavio S. Glock wrote:
> How about a question for the FAQ?
> 
> http://perlmonks.org/index.pl?node_id=298788
> >
> > Calculate down time of devices in prime time (only working hours, excluding 
> > p_holidays)
> >  by albertc on Oct 13, 2003 at 05:00 GMT+3
> >
> > I have up & down datetime data for devices, I need a function that will provide the
> > downtime within the primetime period. Input will be d_time, u_time, stime 
> > (starting time
> > for Primetime, 08:00:00), etime (endtime for PrimeTime, 18:59:59). The function 
> > also
> > needs to remove downtime that occured on a public holiday and over weekends! Public
> > holidays will be read from mysql table with Datetime record of each public holiday.
> 
> 
> - Flavio S. Glock


Re: "Calculate down time"

2003-10-13 Thread Dave Rolsky
On Mon, 13 Oct 2003, Flavio S. Glock wrote:

> How about a question for the FAQ?
>
> http://perlmonks.org/index.pl?node_id=298788
> >
> > Calculate down time of devices in prime time (only working hours, excluding 
> > p_holidays)
> >  by albertc on Oct 13, 2003 at 05:00 GMT+3
> >
> > I have up & down datetime data for devices, I need a function that will provide the
> > downtime within the primetime period. Input will be d_time, u_time, stime 
> > (starting time
> > for Primetime, 08:00:00), etime (endtime for PrimeTime, 18:59:59). The function 
> > also
> > needs to remove downtime that occured on a public holiday and over weekends! Public
> > holidays will be read from mysql table with Datetime record of each public holiday.

Unfortunately, I don't know that we have a great solution yet, do we?  I
think this could be done with a bunch of spanset intersections, but
ideally there'd be business modules to handle a lot of this.


-dave

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


"Calculate down time"

2003-10-13 Thread Flavio S. Glock
How about a question for the FAQ?

http://perlmonks.org/index.pl?node_id=298788
>
> Calculate down time of devices in prime time (only working hours, excluding 
> p_holidays)
>  by albertc on Oct 13, 2003 at 05:00 GMT+3
>
> I have up & down datetime data for devices, I need a function that will provide the
> downtime within the primetime period. Input will be d_time, u_time, stime (starting 
> time
> for Primetime, 08:00:00), etime (endtime for PrimeTime, 18:59:59). The function also
> needs to remove downtime that occured on a public holiday and over weekends! Public
> holidays will be read from mysql table with Datetime record of each public holiday.


- Flavio S. Glock


RE: [Kinda OT] Could somebody double check this?

2003-10-13 Thread Hill, Ronald

Hi Maki,

> 
> Hi, dt-ers.
> 
> I've been lurking on this list for some time now, and so far I
> understand that while a few people have attempted, nobody has come up
> with a lunar, solar, or lunisolar calenders (at least I don't remember
> seeing it on this list).

This is correct, there was talk of doing this however, it is not easy.
The last I heard, there was work on getting the SLA library released
under the LGPL. (hopefully this will include a windows port of the library)
This library has all of the functions needed for lunisolar calenders.

Ron Hill


Re: SpanSet Issues and Requests

2003-10-13 Thread Flavio S. Glock
Rick Measham wrote:
> 
> I'm trying to get next/previous spans from a given DateTime. I'm
> defining next/previous as the event who started before or after $dt.
> Where it ends doesn't matter, even if we're still in the middle of the
> event.

Rick:

Did you get it working? 

I'm starting the implementation of DateTime::SpanSet next/previous.
I'll use these definitions:

  next - first span of 
$set->intersection( DT::Span->from_datetimes( after => $dt ) )

  previous - last span of 
$set->intersection( DT::Span->from_datetimes( before => $dt ) )

- Flavio S. Glock