http://qs321.pair.com?node_id=11137497


in reply to iterating over time with DateTime to obtain values with Astro::Coords

Q2) How do I take $dt and $phases[0] and get epoch time?

Could you explain what do you mean by "get epoch time" (as &Astro::MoonPhase::phasehunt already returns a list of 5 epochs for 5 phases)?

  • Comment on Re: iterating over time with DateTime to obtain values with Astro::Coords

Replies are listed 'Best First'.
Re^2: iterating over time with DateTime to obtain values with Astro::Coords
by Aldebaran (Curate) on Oct 14, 2021 at 20:08 UTC
    Could you explain what do you mean by "get epoch time"

    This is what I meant.

    # create a DateTime object from an ISO timestring my $isostr = '2021-10-09T11:13:57'; # jd 2459496.96802 my $dt = DateTime::Format::ISO8601->parse_datetime($isostr); my @phases = phasehunt($dt->epoch); $logger->info("@phases"); my $start_epoch = $phases[0]; my $end_epoch = $phases[4]; my $diff = $end_epoch - $start_epoch; my $hard_bottom = int($start_epoch); $logger->info("integer bottom is $hard_bottom");

    Output:

    2021/10/14 13:49:52 INFO 1633518344.15928 1634095655.87543 1634741861. +07993 1635451604.37235 1636060526.50686 2021/10/14 13:49:52 INFO integer bottom is 1633518344

    Anything numerical happens over an interval, and paying special attention to the bounds has a profound bearing on whether results are valid. I like to bound an interval with lub and glb integers to check results with familiar tools.

    Thanks for your comments, I'm trying to get this written before before the interval has elapsed....