wscript.echo lst & Chr(10)& Chr(13) & "Calculated from your system clock." & Chr(10)& Chr(13) & "Accounting for US Daylight Saving Time." & Chr(10)& Chr(13) & "For longitude " & getlongitude '==================================================================== '============================CALC LST================================ Function LST() Dim sidtime jd0 = calcJD() sidtime = calcST(jd0) LST = sidtime end function Function LSTdms() Dim sidtime jd0 = calcJD() sidtime = calcST(jd0) LST = sidtime end function Function getLongitude 'Set your longitude here getLongitude=-117.7133333333 End Function Function getTime(thetime) Dim thehour, theminute, thesecond thehour = Hour(thetime) theminute = Minute(thetime) thesecond = Second(thetime) getTime = thehour + theminute/60 + thesecond/3600 end Function Function getTzone() dim longit longit = getLongitude() getTzone = CInt(longit/15) + CheckDaylightSavingTime() End Function Function calcJD() 'creates t and jdy0 dim y, m, d, t, tzone y = Year(Now) m = Month(now) d = Day(now) t = getTime(now) tzone = getTzone() if m <= 2 then y = y - 1 m = m + 12 end if Dim a, b, jdg, jdyo jdyo = 0 a = Int(y/100) b = 2 - a + Int(a/4) d = d + t/24 jdg = Int(365.25*(y+4716))+Int(30.6001*(m+1))+d+b-1524.5 ' Correct the time for UT from local standard time - this only sets up calc to give the right jd for 0h UT jdg = jdg - tzone/24 jdyo = Int(jdg+0.5) - 0.5 ' Julian day 0h UT calcJD = jdyo end Function Function calcST(jdi) Dim t1,t2,tzone2 t = getTime(now) t1 = 0 tzone = getTzone() Dim longitude longitude = getLongitude() Dim st, ut, n Dim hr, mn, sc ' calculate the siderial time at Greenwich in degrees at 0h UT t1 = (jdi-2451545.0)/36525 st = 100.46061837+36000.77053608*t1+0.000387933*t1*t1-t1*t1*t1/38710000 ' correct for other time and time zone ' remember that julian day is for 0h UT (add in time plus time zone (negative =west)) ' The following gives the UT for the time, t in time zone tzone ut = (t-tzone) ' example if tzone = -4 hours and time = 15 hours (3 pm) then UT = 15+4 = 19 hours (remember st is in degrees) st = st + 1.002738*ut*15 ' Now calculate local siderial time which is your longitude less than the st at greenwich st = st+longitude ' Reduce the angle to 0-360 if st < 0 then n = Int(Abs(st/360)) st = st + ((n+1)*360) end if hr = Int(st/15) mn = Int(((st/15)-hr)*60) sc = CInt((((st/15)-hr)*60-mn)*60) if hr > 24 then n = Int(hr/24) hr = hr - n*24 end if siderial = ""&hr&"h"&mn&"m"&sc&"s" Dim LSTdec LSTdec = (st/15) if LSTdec > 24 then n = Int(LSTdec/24) LSTdec = LSTdec - n*24 end if calcST = LSTdec end function '^=^=^=^=^=^=^=^=^=^=^=^=^=^=CALC LST=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^ '==================================================================== '------------------------DAYLIGHT SAVING TIME----------------------- Function CheckDaylightSavingTime() dim theyear,themonth,theday,spring,fall theyear = year(Now) themonth = month(Now) theday = day(Now) spring = SpringAhead(theyear) fall = FallBack(theyear) If themonth >= 1 Then If themonth < 4 Then CheckDaylightSavingTime = 0 end if end if if themonth = 4 Then if theday >= spring Then CheckDaylightSavingTime = 1 Elseif theday < spring Then CheckDaylightSavingTime = 0 end if end if if themonth > 4 Then if themonth < 10 Then CheckDaylightSavingTime = 1 end if end if if themonth = 10 Then if theday < fall Then CheckDaylightSavingTime = 1 Elseif theday >= fall then CheckDaylightSavingTime = 0 end if end if if themonth > 10 Then if themonth <= 12 Then CheckDaylightSavingTime = 0 end if end if End Function Function SpringAhead(yeary) Dim thisYear, AprilDate, ADshort thisYear = CInt(yeary) ADshort = 2+6*thisYear-Int(thisYear/4) AprilDate = CInt(( ADshort/7 - Int(ADshort/7) )*7 + 1) SpringAhead = AprilDate End Function Function FallBack(yeary) Dim thisYear, OctoberDate, ODshort thisYear = CInt(yeary) ODshort = Int(thisYear*5/4)+1 OctoberDate = CInt(31-( ODshort/7 - Int(ODshort/7) )*7) FallBack = OctoberDate End Function '---------------------------------------------------------------------