Ouch ! ! !
OK. I may have been mistaken. DOn’t take it so personally.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
P.S. I’ve been away for 2 weeks which is why I’m commenting on this now.
Happy New Year
“Rob” <> rob@spamyourself.com> > wrote in message
news:a006i9$2e4$> 1@inn.qnx.com> …
Speak for yourself, Bill >
Here’s a little test program that demonstrates I do know what I’m
talking
about…
Output for central time should be:
Spring Equinox = Sun Apr 01 00:00:00 2001 cst
Tick… = Sun Apr 01 01:59:59 2001 cst
Tick… = Sun Apr 01 03:00:00 2001 cdt
Tick… = Sun Apr 01 03:00:01 2001 cdt
Fall Equinox = Sun Oct 28 00:00:00 2001 cdt
Tick… = Sun Oct 28 01:59:59 2001 cdt
Tick… = Sun Oct 28 01:00:00 2001 cst
Tick… = Sun Oct 28 01:00:01 2001 cst
Rob
P.S.
Everyone does understand (now) that 10/28/2001 1:59:00 is ambiguous…
with
out a DST indicator… right??
#include <stdio.h
#include <stdlib.h
#include <string.h
#include <time.h
#include <sys/types.h
void main( void )
{
int i;
char tbuf[80];
time_t t;
struct tm tm, *ptm;
//
// Get the struct tm for today… we’ll need it.
//
time( &t );
ptm = localtime( &t );
//
// Find the Spring Equinox for this year.
// First Sunday in April
//
memset( &tm, 0, sizeof( tm ) );
tm.tm_mon = 3;
tm.tm_year = ptm->tm_year;
do {
tm.tm_mday += 1;
tm.tm_isdst = -1; // Let mktime() figure out tm_isdst
t = mktime( &tm );
ptm = localtime( &t );
} while( ptm->tm_wday != 0 );
strftime( tbuf, 80, “%c %Z”, &tm );
printf( “Spring Equinox = %s\n”, tbuf );
//
// OK… we’re at midnight.
// Add 1 hour + 59 minutes + 59 seconds (= 7199 seconds)
// So we’re 1 second before time change
// And then do 3 ticks through time change
//
for( t += 7199, i = 0; i < 3; t++, i++ ) {
ptm = localtime( &t );
strftime( tbuf, 80, “%c %Z”, ptm );
printf( “Tick… = %s\n”, tbuf );
}
//
// Another verse, same as the first… except for the Fall Equinox
//
//
// Find the Fall Equinox for this year.
// Last Sunday in October
//
memset( &tm, 0, sizeof( tm ) );
tm.tm_mon = 9;
tm.tm_mday = 32; // 1 day past end-of-month, so
do/while()
works right
tm.tm_year = ptm->tm_year;
do {
tm.tm_mday -= 1;
tm.tm_isdst = -1; // Let mktime() figure out tm_isdst
t = mktime( &tm );
ptm = localtime( &t );
} while( ptm->tm_wday != 0 );
strftime( tbuf, 80, “%c %Z”, &tm );
printf( “Fall Equinox = %s\n”, tbuf );
//
// OK… we’re at midnight.
// Add 1 hour + 59 minutes + 59 seconds (= 7199 seconds)
// So we’re 1 second before time change
// And then do 3 ticks through time change
//
for( t += 7199, i = 0; i < 3; t++, i++ ) {
ptm = localtime( &t );
strftime( tbuf, 80, “%c %Z”, ptm );
printf( “Tick… = %s\n”, tbuf );
}
}
“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:9vvpna$nff$> 1@inn.qnx.com> …
OK. I’ve read the other two comments. But I alwys thought that at
3:00
AM
the clock went back to 2 AM. So I think you didn’t set it ahead
enough.
Just show that none of us really know what we’re talking about.
RE: version of date, just do ‘which -l date’.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
“Ian Cannon” <> ianc@tecom.com.au> > wrote in message
news:> Voyager.011221114303.22734A@aresnode2.tecom.com.au> …
Previously, Rob wrote in qdn.public.qnx4.devtools:
What we have found is that if you change the time back during the 1
hour
interval between normal and daylight saving time that the resulting
time
is
always messed up
Just my $0.02 US…
You really need to be looking at the UTC date stamp too. When you
set
your
computer to 10/28/2001 1:59:00 you probably have all ready gone
past
the
actual “fall back” time… The hour from 1:00-1:59 am actually
occurs
twice
that evening. Try setting it to 0:59:00 and wait 61 minutes >
Also,
when
you execute ‘date’ does it report est or edt?
Rob
“Daniel A. Szymanski” <> szymanski@sanyo-machine.com> > wrote in
message
news:> 3C227D7A.8D2D8B2@sanyo-machine.com> …
Bill,
Basically, I did the following
(TZ=est05edt04,M4.1.0/2,M10.5.0/2)
which I
believe means that the time will move ahead one hour at 2:00 am
on
the
first
Sunday in April and will move back one hour at 2:00 a.m. on the
last
Sunday of
October.
QNX 4.25 is the OS
How would I go about getting the version of ‘date’?
I set the date to 4/1/2001 and the time to 1:59:00 am with the
date
command.
In one minute, the date shows 4/1/2001 3:00 am (which is
correct)
I then set the date to 10/28/2001 and the time to 1:59:00 am
with
the
date
command. In one minute, the date shows 10/28/2001 and the time
2:00:00 am
(which I believe is not correct).
Bill Caroselli wrote:
The end of October is a good time of year to buy a new
computer
each
year
;~}
Actually, I have not had this problem. Can you give more
details,
time
before the change, time after the changem indicated time after
the
change,
OS version, version of ‘date’.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
“Daniel A. Szymanski” <> szymanski@sanyo-machine.com> > wrote in
message
news:> 3C22603F.F0EE18E3@sanyo-machine.com> …
I currently have a QNX 4.25 machine running with
TZ=est05edt04,M4.1.0/2,M10.5.0/2
I changed the date on the system to check the changes from
est
to
edt
and vice versa. I found that the spring forward change for
the
first
sunday in april worked OK, but the change for the last
sunday
in
october
did not (the time remained the same). Any suggestions?
Thank you.
Dan Szymanski
\