Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Suse Handling of Daylight Saving Time (DST) change

News NTP -- Network Time Protocol Recommended Links Linux Networking Configuration Troubleshooting NTP on Red Hat Linux
RHEL handling of DST change Troubleshooting NTP on Solaris ILO 3 NTP configuration Humor Etc

Most server hardware clocks are use UTC. UTC stands for the Universal Time, Coordinated, also known as Greenwich Mean Time (GMT). Other time zones are determined by adding or subtracting from the UTC time. Server typically displays local time, which now is subject of DST correction twice a year. 

Wikipedia defines DST as follows:

Daylight saving time (DST), also known as summer time in British English, is the convention of advancing clocks so that evenings have more daylight and mornings have less. Typically clocks are adjusted forward one hour in late winter or early spring and are adjusted backward in autumn. 

DST patch is only required in few countries such as USA.  Please see this wikipedia article.

Linux will change to and from DST when the HWCLOCK setting  in /etc/sysconfig/clock  is set to -u, i.e. when the hardware clock is set to UTC (which is closely related to GMT), regardless of whether Linux was running at the time DST is entered or left.

When the HWCLOCK setting is set to `--localtime', Linux will not adjust the time, operating under the assumption that your system may be a dual boot system at that time and that the other OS takes care of the DST switch. If that was not the case, the DST change needs to be made manually.

Note:

EST is defined as being GMT-5 all year round. US/Eastern, on the other hand, means GMT-5 or GMT-4 depending on whether Daylight Savings Time (DST) is in effect or not.

The tzdata package contains data files with rules for various timezones around the world. When this package is updated, it will update multiple timezone changes for all previous timezone fixes.

he local time as seen by regular applications under Linux is based on two things:

To list the valid values for TZ, execute
$ cd /usr/share/zoneinfo ; find | grep EST
./EST
./right/EST
./right/EST5EDT
./posix/EST
./posix/EST5EDT
./EST5EDT

These zoneinfo files, part of the timezone package, are not human-readable. To check the data in them, use the zdump command. For example,

$ zdump  EST
EST  Thu Oct 24 18:09:54 2013 EST
The output of zdump -v lists all clock jumps for this timezone, including the offset from Greenwich Mean Time and whether DST applies (it does when isdst=1).
$ zdump -v EST
EST  -9223372036854775808 = NULL
EST  -9223372036854689408 = NULL
EST  9223372036854689407 = NULL
EST  9223372036854775807 = NULL

 


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

Support Daylight Saving Time (DST) Handling in Linux

System time and hardware clock

The Linux kernel maintains a system time. This time is initialized at boot time using the hardware clock(also known as real time clock, RTC, BIOS clock or CMOS clock). As the hardware clock does not provide information as to whether it is kept in UTC or in local time, this needs to be configured explicitly, in YaST -> System -> /etc/sysconfig Editor -> System -> Environment -> Clock -> HWCLOCK.

Linux changing to and from DST

Linux will change to and from DST when the HWCLOCK setting is set to `-u', i.e. when the hardware clock is set to UTC (which is closely related to GMT), regardless of whether Linux was running at the time DST is entered or left.

When the HWCLOCK setting is set to `--localtime', Linux will not adjust the time, operating under the assumption that your system may be a dual boot system at that time and that the other OS takes care of the DST switch. If that was not the case, the DST change needs to be made manually.

Regular applications

T

Java applications

The Java Runtime Environment (JRE) includes its own, slightly different, timezone database. Thus, when the timezone definitions change, the JRE should be updated as well.

Additional Information

Manually updating timezone data for regular applications

To address the time zone changes that have not been updated in currently available updates, the following manual process can be used to update systems immediately.

Notes about this process:

  1. These "manual" changes WILL be lost if updates are applied to the system that do not contain the corrected timezone information. The timezone information is included in the timezone package. Applying older versions of this or related packages should be followed by re-applying these "manual" changes.

  2. These "manual" changes do not require a reboot of the system. Some applications may have cached information in memory and will not re-read these changes. A reboot may be useful to ensure all applications have read the updated timezone data.

Detailed steps for the manual process:
  1. Download the most recent time zone data file (at the time of writing, tzdata2007b.tar.gz) from ftp://elsie.nci.nih.gov/pub/. Updates to this data file have the year and release letter updated.
  2. Copy the file to a temporary workspace of your choice on the Linux system.
  3. Extract the data with the following command:

    tar xvfz tzdata2007b.tar.gz

  4. Apply the updates for the region(s) of interest the system's time zone data through the zic command. E.g., to update the North American data, run

    zic northamerica

  5. Relink the new time zone names with the old time zone names that were just updated with the following command: (See the Additional Notes below for a workaround to possible error(s) in this step.)

    zic backward

  6. Verify that the updates are applied correctly with the following command

    zdump -v timezoneofinterest | grep yearofinterest

    e.g

    zdump -v Canada/Mountain | grep 2007

    The output from the previous step should look similar to this:
    Canada/Mountain Sun Mar 11 08:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 MST isdst=0 gmtoff=-25200
    Canada/Mountain Sun Mar 11 09:00:00 2007 UTC = Sun Mar 11 02:00:00 2007 MST isdst=1 gmtoff=-21600
    Canada/Mountain Sun Nov 4 07:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 MST isdst=1 gmtoff=-21600
    Canada/Mountain Sun Nov 4 08:00:00 2007 UTC = Sun Nov 4 02:00:00 2007 MST isdst=0 gmtoff=-25200
  7. Relink the localtime setting (in /etc/localtime) with the corrected timezone information using the following command

    zic -l timezonename

    e.g.

    zic -l Canada/Mountain

Note: If you encounter error(s) executing zic backward
Executing zic backward may return errors if other time zone data is not recent enough. One option would be to update those time zone as well in the same manner as noted in step 4 after identifying the specific time zones involved.
A workaround in this situation is to extract only the time zones from backward that need to be re-linked following execution of step 4 above. In this case that would be the time zones that are listed in the northamerica file. The following steps can be substitued for step 5 above:

grep 'America' backward > backward.america
zic backward.america

Validating DST changes for Java

To validate whether DST changes occur on the correct date for Java code, the following test code can be used:

import java.util.*;
import java.text.*;

class testdst {
public static void main(String args[]){
if((args.length != 4)){
if((args.length == 1) && args[0].equals("-list")){
System.out.println("Available time zones are:");
String[] list = TimeZone.getAvailableIDs();
int i;

for(i = 0; i < list.length; i++)
System.out.println(list[i]);
} else {
System.out.println("Usage testdst ");
System.out.println("or testdst -list");
}
System.exit(1);
}
TimeZone t = TimeZone.getTimeZone(args[0]);
System.out.println("Using time zone " + t.getDisplayName());
System.out.println("Use parameter -list to get a list of available time zones");
GregorianCalendar cal = new GregorianCalendar(t);
int year = new Integer(args[1]).intValue() - 1900;
int month = new Integer(args[2]).intValue() - 1;
int day = new Integer(args[3]).intValue();

Date d = new Date(year, month, day, 12, 0);
System.out.println("Testing date " + DateFormat.getDateInstance().format(d));
cal.setTime(d);

int offset_day = cal.get(Calendar.DST_OFFSET);
Date d2 = new Date(year, month, day-1, 12, 0);
cal.setTime(d2);

int offset_preday = cal.get(Calendar.DST_OFFSET);

if(offset_day == offset_preday)
System.out.println("There was no change in the daylight saving time offset");
else
System.out.println("The daylight saving time offset was changed");

System.exit(0);
}
}

Please refer to the documentation of the Java SDK and runtime environment for details on how to compile and run it.

Recommended Links

Top Visited

Bulletin Latest Past week Past month
Google Search



For general information about DST, please refer to Wikipedia,Daylight saving time, http://en.wikipedia.org/wiki/Daylight_saving_time.

For information about the zoneinfo database which is the basis for the timezone information in the timezone package, refer to Wikipedia, Zoneinfo, http://en.wikipedia.org/wiki/Zoneinfo.



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March 12, 2019