simple application that shows sunset and sunrise times based on your latitude and longitude
- C 100%
|
David Goerger
9822e9cbe9
cleanup and reformat for mobile view
Present a more concise layout better optimized for daily summaries sent via XMPP and/or similar messaging apps. Link: https://review.daemonica.net/id/I90ac3ba3ce26ae0e23e755ede036b1e38140ef80 Reviewed-on: https://review.daemonica.net/c/dgoerger/sunstat/+/101 Reviewed-by: David Goerger <dgoerger@daemonica.net> |
||
|---|---|---|
| .gitignore | simplify output and reformat KNF | |
| .pre-commit-config.yaml | set up pre-commit, reformat with clang-format --style=Mozilla | |
| configure | fork and refactor | |
| LICENSE | fork and refactor | |
| README.md | test compatibility against newer OSes | |
| sunriset.h | set up pre-commit, reformat with clang-format --style=Mozilla | |
| sunstat.c | cleanup and reformat for mobile view | |
About
sunstat is a simple public domain application that shows sunset and sunrise based on your latitude and longitude.
The sunriset library is based on the excellent code by Paul Schlyter. sunstat is based on the sun application by Joachim Nilsson.
Build
Compilation follows the usual "./configure; make; make install" semantics.
$ ./configure
checking for C compiler... cc
checking for pledge... yes
creating Makefile... done
$ make
cc -DHAVE_CONFIG -Wall -Wextra -g -O2 -c sunstat.c
cc -o sunstat sunstat.o -lm
$ doas make install
install -d /usr/local/bin
install -s -o root -g bin -m 0755 sunstat /usr/local/bin
Usage
$ sunstat
Usage:
sunstat +/-latitude +/-longitude
Examples:
sunstat +40.6611 -73.9439 (use $TZ || /etc/localtime)
TZ='America/New_York' sunstat +40.6611 -73.9439
TZ='UTC' sunstat +40.6611 -73.9439
$ # print today's sunrise/sunset times
$ # .. for Minneapolis
$
$ TZ='America/Chicago' sunstat +44.9819 -93.2692
Sunrise Sunset
07:35 CST 17:17 CST
Civil twilight 07:03 CST 17:48 CST
Nautical twilight 06:28 CST 18:24 CST
Astronomical twilight 05:54 CST 18:58 CST
Hours of daylight, incl. civil twilight: 10h44m58s.
The Sun is overhead (due south/north) at 12:26 CST.
Compatibility
Tested on
-
OpenBSD 6.6 - 7.2
-
Alpine 3.11 - 3.16
-
Debian 10 - 11
-
FreeBSD 12 - 13
-
CentOS 8
-
Fedora 30
-
macOS Catalina 10.15
-
NetBSD 8.1 - NetBSD 9.3