risacher / sunwait

Sunwait calculates sunrise or sunset times with civil, nautical, astronomical and custom twilights, for use with Windows Task Scheduler or 'cron' on Linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Negative longitude reported as E instead of W.

Jerry2840 opened this issue · comments

sunriset.c
Has:
/* Note: Eastern longitude positive, Western longitude negative */

I changed sunwait.h to my location:
//#define DEFAULT_LATITUDE 52.952308
//#define DEFAULT_LONGITUDE 359.048052 /* The Buttercross, Bingham, England /
#define DEFAULT_LATITUDE 40.767218
#define DEFAULT_LONGITUDE -111.902899 /
Salt Lake City, Utah */

It looks like the times are right, but is says E instead of W.
I am not sure what is setting the E or W in the code.

# ./sunwait report

  Current Date and Time: 15-Jun-2019 21:23 MDT

Target Information ...

               Location:  40.767218N, -111.902899E
                   Date: 15-Jun-2019
               Timezone: MDT

Sun directly north/south: 13:27
Twilight angle: -0.83 degrees (daylight)
Day with twilight: 05:54 to 21:01
It is: Night

Note: the 'N' and 'E' are hard coded in print.cpp (bug). I deleted those letters in mine, before compilation, without effecting additional functionality.

Interestingly The Butter Cross Public House is at 52.9526528,-0.9538435 (from Google Maps) which the default has as 360-0.9538435=‭359.0461565‬ so it's using positive values for West by going full circle.

So your longitude of -111.902899 would be ‭248.097101‬ (which is a bit quirky) but avoids using negative numbers.