473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Handling daylight savings with standard time functions?

Hi,

Is there any way to make time-of-day adjustments for daylight savings
using only standard time functions? We have a program that executes
daily at a fixed time of day. After daylight savings happens, the
time-of-day alignment is lost. For example, if the daily task gets
kicked in at 9 p.m. every evening, after daylight savings ends in
fall, the task is shown as kicking in at 8 p.m. Similarly, if the
daily task gets kicked in at 4 a.m. every morning, after daylight
savings starts in spring, the task is shown as kicking in at 5 a.m.

I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.

Any help will be appreciated.

Regards,
Anil

Jul 20 '07 #1
3 3266

"Generic Usenet Account" <us****@sta.samsung.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
Hi,

Is there any way to make time-of-day adjustments for daylight savings
using only standard time functions? We have a program that executes
daily at a fixed time of day. After daylight savings happens, the
time-of-day alignment is lost. For example, if the daily task gets
kicked in at 9 p.m. every evening, after daylight savings ends in
fall, the task is shown as kicking in at 8 p.m. Similarly, if the
daily task gets kicked in at 4 a.m. every morning, after daylight
savings starts in spring, the task is shown as kicking in at 5 a.m.

I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.

Any help will be appreciated.

Why not just use the system time and let it worry about the correct time?

Regards,
Anil

Jul 20 '07 #2
GeekBoy wrote:
"Generic Usenet Account" <us****@sta.samsung.comwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
>Hi,

Is there any way to make time-of-day adjustments for daylight savings
using only standard time functions? We have a program that executes
daily at a fixed time of day. After daylight savings happens, the
time-of-day alignment is lost. For example, if the daily task gets
kicked in at 9 p.m. every evening, after daylight savings ends in
fall, the task is shown as kicking in at 8 p.m. Similarly, if the
daily task gets kicked in at 4 a.m. every morning, after daylight
savings starts in spring, the task is shown as kicking in at 5 a.m.

I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.

Any help will be appreciated.


Why not just use the system time and let it worry about the correct time?

>Regards,
Anil

I notice the US Congress has changed the beginning and end of DST in an
arbitrary and capricious manner this year. So I think system time.
Jul 20 '07 #3
Generic Usenet Account <us****@sta.samsung.comwrote:
>
I tried a few things, including explicitly advancing the day field in
the struct tm structure (sample source code posted to comp.sources.d),
without messing with the seconds, minutes and hours fields. However,
even that is not working. It appears that mktime() is not smart
enough to detect that daylight savings has started/ended.
Did you set the isdst field to some negative value to tell mktime() that
you wanted it to try to figure it out?

-Larry Jones

Things are never quite as scary when you've got a best friend. -- Calvin
Jul 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bathroom_Monkey | last post by:
For posterity's sake, here is an algorithm I created to take a GMT time and convert it to U.S. central time, accounting for daylight saving time. Note: this algorithm can be modified to work for...
2
by: hourang | last post by:
ok im getting tired of looking for an answer and coming up short with scripts that dont work. i have a application that uses GMT for all its times and needs the clients timeoffset for showing the...
1
by: Ernie | last post by:
I am creating an .ics file that when opened (via Outlook) inserts a meeting into the calendar. All works fine unless the date and time I'm inserting happens to occur on the hour the time changes...
1
by: Drew | last post by:
Is there a way to check if it is daylight savings or not via c#? I have heard you can use System.Globalization? Thanks - Drew
3
by: chrisdevey | last post by:
Is there any way to make a System.Timers.Timer adjust for daylight savings time change? In a long running process I set a timer as follows for a daily expiration: _myTimer = new...
3
by: Anna | last post by:
Hi, I've already found out that .Net Framework 1.1 does not properly handle anything that is related to a non-current timezone. Since my project should be released before the release of...
3
by: mmuras | last post by:
I did not see any discussions / threads for this but if there is one please let me know: -First, I am one of only two individuals within my company's IT Dept. -We have a Windows Server 2003 R2...
4
by: Polaris431 | last post by:
I have a web application in ASP.NET that will be used globally. Data is collected on mobile devices running Windows Mobile and sent to the web server where it is stored and can be viewed. Data is...
3
by: Generic Usenet Account | last post by:
Hi, Is there any way to make time-of-day adjustments for daylight savings using only standard time functions? We have a program that executes daily at a fixed time of day. After daylight...
3
by: bernhard Hoyler | last post by:
Hi, I would like to determine whether at a certain time point in time the daylight savings time is in effect. This means such a logic should show that today (16-Nov-2007) no daylight savings...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.