LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Getting info like sunrise and sunset times (https://www.linuxquestions.org/questions/linux-general-1/getting-info-like-sunrise-and-sunset-times-602070/)

hamster 11-24-2007 06:22 AM

Getting info like sunrise and sunset times
 
Hi Folks,

This might seem like a strange question but the more I use linux - the more it seems possible. When I login I like to have a fortune cookie read from /usr/games/fortune for example. Is it possible or does anyone know of any tool or small program that I could get and call to display today's sunrise and sunset times for the day - in text in the terminal like say fortune. Unusual I know but I am sure there are a few astronomy fans among you! :)

hamster 11-24-2007 06:52 AM

I came across a text based calendar called wyrd. I am going to try this - it seems what I need. Another tool called remind does the same thing - it is a running service. Let you know what I think! :)

matthewg42 11-24-2007 10:25 AM

Not a command-line method, but sort of related so I volunteer the information for those directed here by the likes of google to whom it may be relevant:

GNU emacs has a daylight time function, available through the calendar:
  • Open a calendar buffer using:
    Code:

    M-x calendar
  • Press S (upper case s). You will be prompted for your longitude, latitude and timezone information.
  • You can permanently set your position data in your ~/.emacs file like this:
    Code:

    (setq calendar-latitude +53.950)
    (setq calendar-longitude -1.083)
    (setq calendar-location-name "York, England")

  • Timezone data should be taken from your system settings, but you can over-ride these by setting the variables: calendar-time-zone, calendar-standard-time-zone-name, calendar-daylight-time-zone-name.

hamster 11-24-2007 11:20 AM

Quote:

Originally Posted by matthewg42 (Post 2969355)
Not a command-line method, but sort of related so I volunteer the information for those directed here by the likes of google to whom it may be relevant:

GNU emacs has a daylight time function, available through the calendar:
  • Open a calendar buffer using:
    Code:

    M-x calendar
  • Press S (upper case s). You will be prompted for your longitude, latitude and timezone information.
  • You can permanently set your position data in your ~/.emacs file like this:
    Code:

    (setq calendar-latitude +53.950)
    (setq calendar-longitude -1.083)
    (setq calendar-location-name "York, England")

  • Timezone data should be taken from your system settings, but you can over-ride these by setting the variables: calendar-time-zone, calendar-standard-time-zone-name, calendar-daylight-time-zone-name.

Thanks! That's a good tip, I'll try that.

leeeoooooo 02-02-2010 06:16 PM

command line utility?
 
I've got the same question, but I don't want to have to go through Emacs.

Yes, Emacs started talking dirty to me (in the very nicest way) when I learned it could give me a calendar but also moon phases and sunrise and sunset times...oooooh baby, you know what I like!



But what I'm looking for is something simpler I can add to my login sequence like fortune and pom (that give you the current phase of the moon).



Is there a simple command line utility that will spit out the sunrise and sunset for a given location and date (or today, this locale if not otherwise specified)?

I have an *old* Basic routine that I could modify for this, and I can probably find some other astronomical programs that I could twist to my purposes, but I don't want to reinvent another wheel.


All times are GMT -5. The time now is 08:50 AM.