KenWillmott / SolarPosition

Arduino Library to calculate the position of the sun relative to geographic coordinates
71 stars 21 forks source link

time zone #8

Closed microElabDevelop closed 1 year ago

microElabDevelop commented 1 year ago

how to add time difference like -4.. i need exact live sun poistion for soler tracker , is that right lib to use?

KenWillmott commented 1 year ago

The calculations don't have anything at all to do with local time zones. The exact live sun position is based on UTC time in order to make it time zone independent. You didn't say whether the -4 difference takes you from UTC to local, or from local to UTC time.

The correct way to use this library (and some would say the correct way to use an RTC), is to set the RTC to UTC time, and perform a local time conversion if it is needed for other purposes. Actually, this is the way that C and Unix have always handled time.

The sun calculations, like all astronomical calculations, are always referenced to universal time, because the positions of sky objects depends only on that, and on the observers position on the surface of the earth.