Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Timestamp - confusion with daylight saving time Post 71746 by Perderabo on Saturday 14th of May 2005 09:31:20 AM
Old 05-14-2005
Quote:
Originally Posted by softmachine
in autumn the unix-timestamp follows further its continuous mode and the real time as well: i.e. that the time does not step back again one hour.
Excuse me?

Code:
$ cat timetool.c
#include <stdlib.h>
#include <time.h>

main(argc,argv)
char **argv;
{
        long start, now;
        char buff[100];
        struct tm *tm;
        start=atoi(argv[1]);
        for(now=start; now < (start + 18 * 600); now+=600) {
                tm=localtime(&now);
                strftime(buff,100, "%A  %b %e, %Y  %H:%M %Z", tm);
                printf(" %13d   =  %s \n", now, buff);
        }

}
$ ./timetool 1130647000
    1130647000   =  Sunday  Oct 30, 2005  00:36 EDT
    1130647600   =  Sunday  Oct 30, 2005  00:46 EDT
    1130648200   =  Sunday  Oct 30, 2005  00:56 EDT
    1130648800   =  Sunday  Oct 30, 2005  01:06 EDT
    1130649400   =  Sunday  Oct 30, 2005  01:16 EDT
    1130650000   =  Sunday  Oct 30, 2005  01:26 EDT
    1130650600   =  Sunday  Oct 30, 2005  01:36 EDT
    1130651200   =  Sunday  Oct 30, 2005  01:46 EDT
    1130651800   =  Sunday  Oct 30, 2005  01:56 EDT
    1130652400   =  Sunday  Oct 30, 2005  01:06 EST
    1130653000   =  Sunday  Oct 30, 2005  01:16 EST
    1130653600   =  Sunday  Oct 30, 2005  01:26 EST
    1130654200   =  Sunday  Oct 30, 2005  01:36 EST
    1130654800   =  Sunday  Oct 30, 2005  01:46 EST
    1130655400   =  Sunday  Oct 30, 2005  01:56 EST
    1130656000   =  Sunday  Oct 30, 2005  02:06 EST
    1130656600   =  Sunday  Oct 30, 2005  02:16 EST
    1130657200   =  Sunday  Oct 30, 2005  02:26 EST
$

 

9 More Discussions You Might Find Interesting

1. Solaris

disable daylight saving

hi ... i have an E450 sun server that is running solaris 6 . i want to disable daylight savings on my server . My question is : 1) how to know that my server is running daylight savings ? 2) how to disable it ? my zoneinfo file contains the following # @(#)init.dfl 1.2 92/11/26 # #... (1 Reply)
Discussion started by: ppass
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. AIX

Implement daylight saving.

Hi all We are currently using AIX 5.3, we reuquire to change the time according to the daylight saving scenario. We are using the internal clock and are not synced with ntp server. Can any one please tell me how to do that without effecting the processes running on the servers? (1 Reply)
Discussion started by: masquerer
1 Replies

4. Ubuntu

How can I find my current Daylight Saving offset?

Hello all, I'm having a problem where a script needs to calculate GMT time given local time. For 6 months, that's easy. The other 6 months, it's not, as I have to add an extra hour to allow for Daylight Saving. At the moment, I manually add and remove an offset but, for obvious reasons, I'd... (2 Replies)
Discussion started by: alexandicity
2 Replies

5. 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

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. 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

8. Linux

How does Linux handle DST ( daylight saving time)?

Hello Can sombody please tell me how linux handles DST ( daylight saving time) ? Does the time change instantly , ex: if is is 3'o clock does linux instantly swich to 2'o clock ? plese give more info about this toppic (2 Replies)
Discussion started by: martonlorand
2 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
tztab(4)						     Kernel Interfaces Manual							  tztab(4)

NAME
tztab - time zone adjustment table for date and ctime() DESCRIPTION
The file describes the differences between Coordinated Universal Time (UTC) and local time. Several local areas can be represented simul- taneously with historical detail. The file consists of one or more time zone adjustment entries. The first line of the entry contains a unique string that may match the value of the string in the user's environment. The format is where is the time zone name or abbreviation, diff is the difference in hours from UTC, and is the name or abbreviation of the "Daylight Savings" time zone. Fractional values of diff are expressed in minutes preceded by a colon. Each such string will start with an alphabetic character. The second and subsequent lines of each entry details the time zone adjustments for that time zone. The lines contain seven fields each. The first six fields specify the first minute in which the time zone adjustment, specified in the seventh field, applies. The fields are separated by spaces or tabs. The first six are integer patterns that specify the minute (0-59), hour (0-23), day of the month (1-31), month of the year (1-12), year (1970-2038), and day of the week (0-6, with 0=Sunday). The minute, hour, and month of the year must contain a number in the (respective) range indicated above. The day of the month, year, and day of the week can contain a number as above or two numbers separated by a minus (indicating an inclusive range). Either the day of the month or the day of the week field must be a range, the other must be simple number. The seventh field is a string that describes the time zone adjustment in its simplest form: where is an alphabetic string giving the time zone name or abbreviation, and diff is the difference in hours from UTC. must match either the field or the field in the first line of the time zone adjustment entry. Any fractional diff is shown in minutes. Comments begin with a in the first column, and include all characters up to a newline. Comments are ignored. EXTERNAL INFLUENCES
International Code Set Support Single-byte character code sets are supported. EXAMPLES
The time zone adjustment table for the Eastern Time Zone in the United States is: Normally (as indicated in the first line) Eastern Standard Time is five hours earlier than UTC. During Daylight Savings time, it changes to a 4 hour difference. The first time Daylight Savings Time took effect (second line) was on January 6, 1974 at 3:00 a.m., EDT. Note that the minute before was 1:59 a.m., EST. The change back to standard time took effect (sixth line) on the last Sunday in November of the same year. At that point, the time went from 1:59 a.m., EDT to 1:00 a.m., EST. The transition to Daylight Savings Time since then has gone from the last Sunday in February (third line) to the last Sunday in April (fourth line) to the first Sunday in April (fifth line). The return to standard time for the same period has remained at the last Sunday in October (seventh line). AUTHOR
was developed by HP. FILES
SEE ALSO
date(1), ctime(3C), environ(5). tztab(4)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy