Hi,

I just tried an idea I had which was the following:

* Unix time represents the current time in seconds since 00:00:00 UTC,
  January 1, 1970.
* There are 86400 seconds in a day

By combining these tow I can get the normalized UTC time-of-day (ranging from 0.0 .. 1.0) at lat/lon (0.0 , 0.0) using the following code:

time_t t = time(NULL);
double tod = (t / 86400.0);
double daytime = fmod(tod, 1.0);

Given that 12.00 UTC is high noon and 0.00 is midnight it is now easy to determine the sun azimuth for (0,0) by using the following formula:

double azimuth = -90.0 + 180 * daytime.


Now you only need to adjust it for timezone, lat and lon.

Is this correct or am I missing something?

Erik


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to