ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#21640 - 02/23/10 01:22 PM Offset from sunset >-120 minutes
Msradell Offline
journeyman


Registered: 08/19/07
Posts: 60
Loc: Louisville, Kentucky
I'm sure there is a simple solution to do this but it has me stumped. I would like to set up an event to happen more than 120 minutes before sunset. I can envision how to make it work by storing the sunset time to a variable than subtracting a constant and then comparing that to the time of day but I can't figure out how to write the code.

Thanks
_________________________
I've learned that there is a fine line between genius and insanity

Top
#21641 - 02/23/10 01:35 PM Re: Offset from sunset >-120 minutes [Re: Msradell]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
Yes, you can capture the sunset time in a variable (it is in minutes past midnight, and is calculated at midnight) and subtract the amount of minutes that you want from that. Then compare that value against the current time of day also captured to a variable (to also work in minutes past midnight).

IF Time of Day is < sunset // test sunset time
THEN Load Data to: Variable #0 // and capture in Var# 0
THEN Variable #0 - 210 //ex: You want 3.5 hours before sunset
TEHN Variable #1 = Variable #0 //save in variable #1

IF Time of Day is > 00:00 //test current time
THEN Load Data to: Variable #2 //save in variable #2

IF Variable #2 becomes = Variable #1 //if time is reached
THEN ...
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#21642 - 02/23/10 03:00 PM Re: Offset from sunset >-120 minutes [Re: Guy Lavoie]
Msradell Offline
journeyman


Registered: 08/19/07
Posts: 60
Loc: Louisville, Kentucky
Thanks!
_________________________
I've learned that there is a fine line between genius and insanity

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 26 anonymous users online.
Recent Posts
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Does anyone have a copy of the latest TSE?
by sevenzenith1
01/30/12 05:17 AM
Have HAL2000 do the work or the Ocelot?
by khem
01/28/12 02:49 PM
Ocelot + Powermid = Fail
by Guy Lavoie
01/27/12 03:37 PM
Shout Box

Newest Members
dfgg, manu, kuro, sevenzenith1, chuck214
2748 Registered Users
Forum Stats
2747 Members
19 Forums
3835 Topics
22711 Posts

Max Online: 67 @ 08/16/11 03:08 PM
February
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29