Yet Another Time Problem 
Author Message
 Yet Another Time Problem

Hi All,

I'm trying to convert time_t values to their text equivalents on Wintel systems
(NT 4 SP5).  The problem I'm having is due to daylight savings time (DST)
adjustments made by calls to localtime().  Take, for example, April 2, 2000
6:00AM.  When I pass the time_t value representing the April date to localtime()
and pass that result to asctime(), I get April 2, 2000 7:00AM.  This only
happens on DST transition days (first sunday in Apr and last sunday in Oct
after  2:00AM).  I don't want this time adjustment to show up in the result of
asctime().  Does anyone know how to turn this off or to determine the number of
the Sunday in month; whether is first, second, etc.?

--
Robert A. Nurse

ICQ Network Number 207692
http://www.*-*-*.com/ ~rnurse



Sat, 09 Mar 2002 03:00:00 GMT  
 Yet Another Time Problem

Tue, 21 Sep 1999 16:45:21 -0400

Quote:
> I'm trying to convert time_t values to their text equivalents on Wintel systems
> (NT 4 SP5).  The problem I'm having is due to daylight savings time (DST)
> adjustments made by calls to localtime().  Take, for example, April 2, 2000
> 6:00AM.  When I pass the time_t value representing the April date to localtime()
> and pass that result to asctime(), I get April 2, 2000 7:00AM.  This only
> happens on DST transition days (first sunday in Apr and last sunday in Oct
> after  2:00AM).  I don't want this time adjustment to show up in the result of
> asctime().  Does anyone know how to turn this off or to determine the number of
> the Sunday in month; whether is first, second, etc.?

You want the remainder of the transition days (from 2am on)
to use the system before the transition, but not other days?  
Are you sure?  Won't this cause all your users to be one hour
early or late for whatever the event is?

After localtime (or other functions that set/normalize struct tm),
if tm_wday == 0 (Sunday), and tm_mday <= 7 it's the first Sunday;
if tm_mday >= mon_len(tm_mon,isleapyear)-6 it's the last Sunday.  

Or convert a time_t for midnight (before the transition) and
set tm_hour,tm_min,tm_sec yourself before calling asctime.
Although not required or guaranteed by the C standard,
WinNT follows the Unix/POSIX rule that time_t is seconds
with an origin at 00:00 GMT/UTC (on Jan 1 1970) so
it's easy to split (sequential) days and time-of-day.  

(CCed) david.thompson at but not for trintech.com



Sat, 09 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Yet another time.h question (organisation of struct tm)

2. Yet another small problem

3. Yet-another-realloc problem

4. Yet another newbie problem.

5. Yet another var-arg problem...

6. Yet another SAFEARRAY problem...

7. vc++ 5.0 debugger problems, any solutions yet?

8. easy yet frustrating variable order problem

9. Yet another problem with virtual functions

10. yamp (yet another malloc problem)

11. Yet another CString to char* problem

12. Yet another release/debug problem

 

 
Powered by phpBB® Forum Software