473,406 Members | 2,439 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,406 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 3267

"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.