• Uncategorized

About linux : Programmatically-getting-dates-of-time-changes-for-the-next-few-years-in-a-given-country

Question Detail

I was trying to find a an API, list or library to automatically list the dates of future time changes in a given country.

Basically I need a bash script on a linux machine that, if the day is before a time change for a specified country (like the introduction of daylight saving time), should trigger an action. I have it all setup, but how can I get a list of dates without having to insert them manually? I tried searching for a similar service online but to no avail.

Question Answer

Read tzfile(5) and localtime(3) (and strftime(3)). Look into files under /usr/share/zoneinfo/

I understand you are concerned with daylight saving time.

Living in Paris (France) I am concerned by files /usr/share/zoneinfo/CET and /usr/share/zoneinfo/Europe/Paris (with the help of tzfile(5) you could parse them). My /etc/timezone file contains Europe/Paris.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.