pw_images, UTC, TimeZones, LocalTime
Brought to you by:
iridium
From: Phil P. <phi...@sw...> - 2004-01-05 04:09:37
|
To make pw_images display the correct (day or night) icon, for the moment I've hacked up get_sky_image() as follows /* hacked for Sydney, Summer Time, Phil Pierotti, 04-01-03 */ $metarDST_start = '10310200'; // MMddhhmm $metarDST_end = '03280300'; $metarGMTOffset = 10 ; $metarUsesDST = 1; $metarSunRise = 6; $metarSunSet = 20; if($metarUsesDST) { $todayCheck = date('mdHi'); if(($todayCheck >= $metarDST_start) && ($todayCheck < $metarDST_end)) { $metarDSTOffset = 1; } } else { $metarDSTOffset = 0; } $metarTime = ($regs[2] + $metarGMTOffset + $metarDSTOffset) % 24; if (($metarTime > $metarSunSet) || ($metarTime < $metarSunRise)) { /* ------- */ Realistically, for this to be complete and flexible, each ICAO will need the following information: - TimeZone specified as offset from GMT - uses Daylight Savings? - DST start date - DST end date - latitude & longitude The sunrise and sunset times can be calculated from the information from NOAA http://www.srrb.noaa.gov/highlights/sunrise/calcdetails.html Lat and Long can be had for ICAOs from http://weather.noaa.gov/tg/site.shtml directly -> http://weather.noaa.gov/data/nsd_cccc.txt Enjoy, Phil P |