@timbray Research Unix's or Plan 9's astro can give it to you in seconds if you know the lat/long. Give it the -l flag for location, -d flag for date, and -c365 for a year's worth. Probably -k for local (kitchen) time.
Script away.
bismarck=% astro -kc3|grep 'The sun'
The sun sets at 20:02:28 AED
The sun rises at 06:15:17 AED
The sun sets at 20:01:42 AED
The sun rises at 06:16:17 AED
The sun sets at 20:00:53 AED
The sun rises at 06:17:17 AED