Pathologically Eclectic Rubbish Lister PerlMonks

### Re^4: Display tide based on time now.

 on Mar 27, 2013 at 14:16 UTC ( #1025723=note: print w/replies, xml ) Need Help??

in reply to Re^3: Display tide based on time now.
in thread Display tide based on time now.

Here is what I am trying to accomplish:

There are 4 tides in the XML, sometimes 3 but the goal is:

if time now in seconds is greater and equal to the first tide time in the XML, and the now in seconds is less than the second tide time in the XML print the first tide specs.

if time now in seconds is greater and equal to the second tide time in the XML, and the now in seconds is less than the third tide time in the XML, print the second tide specs.

if time now in seconds is greater and equal to the third tide time in the XML, and the now in seconds is less than the fourth tide time in the XML, print the third tide specs.

if time now in seconds is greater and equal to the fourth tide time in the XML, and the now in seconds is less than the first tide time in the XML, print the fourth tide specs.

I hope is clear, but thanks for trying!

Replies are listed 'Best First'.
Re^5: Display tide based on time now.
by Anonymous Monk on Mar 27, 2013 at 18:34 UTC

Sounds like you've got a very straightforward algorithm laid out there. It is difficult to be both "greater" and "equal" at the same time, but I presume you meant to say "or".

You may have also noticed how repetitive it is, and that it can be reworded as a for loop, using N, and (N+1)%\$numTidePoints

Yes I know and that's why I am stuck!

Create A New User
Node Status?
node history
Node Type: note [id://1025723]
help
Chatterbox?
 [karlgoethebier]: this mad my day [karlgoethebier]: no typo [marioroy]: At the Fransiscan monastery, got stuck up high in a tree from pruning and the chainsaw with large branch fell and broke the latter, but not me fortunately. Was stuck there for a while until a firetruck came by. [Corion]: marioroy: So you live dangerously ... [Lady_Aleena]: s/latter/ladder/; # ? marioroy [karlgoethebier]: marioroy: Praise the Lord [marioroy]: Well, that's why there must be angels around, invisible or not. [marioroy]: Lady_Aleena yes, ladder. [marioroy]: Corion, no not intentionally. not at all. [Lady_Aleena]: /ne tries to decide whther or not to take a hammer to hubby's alarm clock.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-05-29 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favorite model of computation is ...

Results (192 votes). Check out past polls.