View topic - the puzzle of timer

the puzzle of timer

anything that doesn't fit to other groups.

the puzzle of timer

Postby xuyong » Fri Aug 01, 2003 3:11 am

in my project,I want to change the time value from type "struct tm" to type "time_t" and later reverse the change(from "time_t "to "struct tm"),
in QNX I write the code below:
struct tm t;
time_t t1;
t.tm_mon=0;
t.tm_mday=1;
t.tm_year=2003-1900;
t.tm_hour=3;
t.tm_min=1
t1=mktime(&t);
and later I use
struct tm* t2=gmtime(&t1);
I found t2->tm_hour is 11, not 3, other value is correct,
anyone can tell me the reason,thank you!
xuyong
Senior Member
 
Posts: 431
Joined: Sun Mar 02, 2003 7:52 am

Postby evanh » Fri Aug 01, 2003 4:17 pm

Set your RTC to GMT rather than local time.

And tick the timezone panel option "The hardware clock uses GMT", in the qnx localisation options.
evanh
QNX Master
 
Posts: 735
Joined: Sat Feb 01, 2003 8:04 am

Postby xuyong » Mon Aug 04, 2003 6:19 am

Can you tell me use which function to set my RTC to GMT?
xuyong
Senior Member
 
Posts: 431
Joined: Sun Mar 02, 2003 7:52 am

Postby evanh » Tue Aug 05, 2003 9:12 am

That's it. That and set the time. You can double check it by rebooting and popping into the bios menus. The bios time should read same as GMT.
evanh
QNX Master
 
Posts: 735
Joined: Sat Feb 01, 2003 8:04 am

Postby xuyong » Wed Aug 06, 2003 1:09 am

But I need to change it in programme,not by manual work.
xuyong
Senior Member
 
Posts: 431
Joined: Sun Mar 02, 2003 7:52 am


Return to General Programming

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests