Sponsored Content
Operating Systems Linux How does Linux handle DST ( daylight saving time)? Post 302922090 by jim mcnamara on Wednesday 22nd of October 2014 10:11:38 AM
Old 10-22-2014
No. Linux uses epoch time - the number of seconds since Jan 1, 1970. Look at the very top right of the pages here on UNIX.com. Look for UNIX time. Currently it is 1413986703 seconds.

There is something called the C runtime library - all of the commands in UNIX use that library. Because people use differing locale settings (alphabetic characters, names for months, different ways od doing daylight savings times etc.) the guys who put this together decided to use some library calls to change the UNIX epoch seconds into human readable time, including changes from standard to daylight time.

ctime() and strftime() are part of that library. The date command uses the library and provides a command line interface for times and dates.

So if you are in a country with no daylight/standard time change, then date knows about it through your locale and timezone settings.
Type
Code:
echo "TZ is $TZ, locale is `locale`"

at the command line to see your settings.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Timestamp - confusion with daylight saving time

Hello! I'm currently working on a climatological dataset that uses unix-timestamp and a real date like 28/03/2004 02:45:00 h. in spring the unix-timestamp follows its continuos mode but in the column of the real date the time jumps one hour forward (e.g. from 1:59:59 to 3:00:00). i think this is... (1 Reply)
Discussion started by: softmachine
1 Replies

2. AIX

Daylight Saving Time patch test

On AIX 5.1, after applying a DST patch or workaround, is there a way to test that the DST changes have taken effect? (1 Reply)
Discussion started by: dangral
1 Replies

3. HP-UX

How to set the Daylight Saving Time (DST) OFF

I have a problem with the time so I need to set the DST to be OFF. is anybody can show me how to set the DST to be OFF? (11 Replies)
Discussion started by: Billy_yuli
11 Replies

4. UNIX for Dummies Questions & Answers

Daylight saving not working properly with linux-2.6. kernel

The daylight saving action is not working Time zone was set for that Australia(parth) and issued reboot. Now for DST, (Daylight Saving Time): For 29 Oct 2006 (sunday) day, if set time is 1:59:00 than after 1 minute it will become 3:00:00 as per DST . This was found to be happening.i.e DST... (1 Reply)
Discussion started by: subratasaharia
1 Replies

5. UNIX for Advanced & Expert Users

Daylight saving not working properly with linux-2.6. kernel

The daylight saving action is not working Time zone was set for that Australia(parth) and issued reboot. Now for DST, (Daylight Saving Time): For 29 Oct 2006 (sunday) day, if set time is 1:59:00 than after 1 minute it will become 3:00:00 as per DST . This was found to be happening.i.e DST... (1 Reply)
Discussion started by: subratasaharia
1 Replies

6. Linux

Reading Daylight Saving Time in Linux using C/C++

Hi folks, I would like to read the start date and end date of the Daylight Saving Time for the given timezone in the given year. What's the function in C/C++ to read the start of the Daylight Saving date and end of Daylight saving date? I'm using Linux 2.6.xx Kernel. For Example, in... (4 Replies)
Discussion started by: suryaemlinux
4 Replies

7. UNIX for Advanced & Expert Users

Handle Autosys with DST Changes

Hi, I have one confusion regarding DST chnages which are going to happen after October. :confused: :confused: I have few jobs on Autosys which run as per Japan Time. they shoudl not be affected by switiching off of DST time. Our autosys instance server is based on UK which is running on... (0 Replies)
Discussion started by: girdharsourabh
0 Replies

8. Linux

How to configure daylight saving time

Hi, I have few doubt on daylight saving. Can any one clarify the below points. 1) How to configure daylight saving(DLS) time ? 2) How to query DLS ? 3) If i set DLS(say some how) will it be autometically changed or user has to manually change system time ? I got few info on net about... (3 Replies)
Discussion started by: ashokd001
3 Replies

9. Solaris

Solaris 11 Daylight Saving Time

Hello, Quick question: How do I verify if my Solaris 11 hosts/zones, configured with NTP, would change automatically to the DST? Thanks! (1 Reply)
Discussion started by: feroccimx
1 Replies
TZ(5)								File Formats Manual							     TZ(5)

NAME
TZ - Time zone environment variable SYNOPSIS
TZ=zone[-]offset[dst[offset][,start[/time],end[/time]]] DESCRIPTION
The TZ environment variable tells functions such as the ctime(3) family and programs like date what the time zone and daylight saving rule is. The value of TZ has the POSIX standardized form shown in the synopsis. This form specifies the zone names, offsets from GMT, and day- light savings changeover times for at least the current year. zone A three or more letter name for the time zone in normal (winter) time. [-]offset A signed time telling the offset of the time zone westwards from Greenwich. The time has the form hh[:mm[:ss]] with a one of two digit hour, and optional two digit minutes and seconds. dst The name of the time zone when daylight savings is in effect. It may be followed by an offset telling how big the clock correction is other than the default of 1 hour. start/time,end/time Specifies the start and end of the daylight savings period. The start and end fields indicate on what day the changeover occurs. They must be in one of the following formats: Jn The Julian day n (1 <= n <= 365) ignoring leap days, i.e. there is no February 29. n The zero-based Julian day (0 <= n <= 365). Leap days are not ignored. Mm.n.d This indicates month m, the n-th occurrence of day d (1 <= m <= 12, 1 <= n <= 5, 0 <= d <= 6, 0=Sunday). The 5-th occurrence means the last occurrence of that day in a month. So M4.1.0 is the first Sunday in April, M9.5.0 is the last Sunday in Septem- ber. The time field indicates the time the changeover occurs on the given day. EXAMPLES
Greenwich Mean Time: TZ=GMT0 Middle European Time, 1 hour east from Greenwich, daylight savings starts on the last Sunday in March at 2 AM and ends on the last Sunday in October at 3 AM: TZ='MET-1MET DST,M3.5.0/2,M10.5.0/3' British time, daylight savings starts and ends at the same moment as MET, but in an earlier time zone: TZ=GMT0BST,M3.5.0/1,M10.5.0/2 The eastern european time zones also have the changeovers at the same absolute time as British time and MET. U.S. Eastern Standard Time, 5 hours west from Greenwich, daylight savings starts on the first Sunday in April at 2 AM and ends on the last Sunday in October at 2 AM: TZ=EST5EDT,M4.1.0/2,M10.5.0/2 It shouldn't surprise you that daylight savings in New Zealand is observed in the months opposite from the previous examples. It starts on the first Sunday in October at 2 AM and ends on the third Sunday in March at 3 AM: TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 SEE ALSO
readclock(8), date(1). BUGS
You may have noticed that many fields are optional. Do no omit them, because the defaults are bogus. If you need daylight savings then fully specify the changeovers. West is negative, east is positive, ask any sailor. AUTHOR
Kees J. Bot (kjb@cs.vu.nl) TZ(5)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy