BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Daylight Saving

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Students)
View previous topic :: View next topic  
Author Message
Roger
Guest





PostPosted: Sat Apr 07, 2007 8:10 am    Post subject: Daylight Saving Reply with quote



When using mktime() and storing the current time for later use I get a
problem with Daylight Saving.

The local time that I stored will be stored in Daylight Saving so if I
use that time in mktime and it is during Daylight Saving the hour will
be incremented.

What I do is:

tm tmTime

if (_daylight == 1) --tmTime.tm_hour; // decrement hour to compensate
for mktime

mktime(&tmTime); // if Daylight Saving mktime increments tmTime.tm_hour

This seems kludgy and I am wondering if there is another preferred
method for dealing with Daylight Saving?

Roger
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Apr 07, 2007 8:10 am    Post subject: Re: Daylight Saving Reply with quote



"Roger" <aretae (AT) magma (DOT) ca> wrote in message
news:46170b88$1 (AT) newsgroups (DOT) borland.com...

Quote:
When using mktime() and storing the current time for later
use I get a problem with Daylight Saving.

Did you install Borland's patches for the new DST rules this year?

Quote:
The local time that I stored will be stored in Daylight Saving so
if I use that time in mktime and it is during Daylight Saving the
hour will be incremented.

Have you considered storing the time in UTC/GMT format instead?


Gambit
Back to top
Roger
Guest





PostPosted: Sat Apr 07, 2007 3:36 pm    Post subject: Re: Daylight Saving Reply with quote



Quote:
Did you install Borland's patches for the new DST rules this year?

No, I assumed that this would just fix issues associated with crossing

the DST boundary. At this time I don't care about that because I am not
interested in HoursBetween, difftime (other than for number of days),
etc when crossing any DST boundary, only for "normal business hours" of
the current date.
Quote:
Have you considered storing the time in UTC/GMT format instead?


I don't think that will help. I guess instead of using if(_daylight ==

1) --tmDateTime.tm_hour a better way would be to take the current
datetime, store it in a structure, and use mktime to get time_t for use
in difftime. I just have to make sure I use mktime equally on both
arguments of difftime.


Thanks,
Roger
Back to top
Roger
Guest





PostPosted: Sat Apr 07, 2007 4:33 pm    Post subject: Re: Daylight Saving Reply with quote

In my case, because I am using the current date, a better way is
probably just setting:

tmDateTime.tm_isdst = _daylight; before

mktime(&tmDateTime);

Roger
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Apr 07, 2007 11:08 pm    Post subject: Re: Daylight Saving Reply with quote

"Roger" <aretae (AT) magma (DOT) ca> wrote in message
news:46177431$1 (AT) newsgroups (DOT) borland.com...

Quote:
No, I assumed that this would just fix issues associated
with crossing the DST boundary.

http://support.codegear.com/entry.jspa?externalID=6293&categoryID=37


Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Students) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.