Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Time managenet in QNX: (4 Items)
   
Time managenet in QNX  
Dear friends,

Hi,
would you please help me?

I want to know how QNX OS manage the time? I have my own RTC driver for my Evaluation Board and merge it in my BSP and 
then built it and ported elf file to the board, but the time of RTC is different to the time of the OS! 

I'm afraid it is my wrong or it is a correct procedure!? how is the OS procedure for the time exactly?

please kindly advise me,

Best Regards
Amin
Re: Time managenet in QNX  
Amin, QNX, like other OS, has its own system timer : 

If You have an rtc, You must use it to update the system time, normally at  system boot up. 
You have to update the Qnx rtc utility including Your specific rtc chip support, or write
your own utility.

Anyway, basically You have to do:
1. Read out Your RTC time
2. Update the system time.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Here a short example:

struct timespec stime;
get_my_rtc_time(&stime);                                           // read RTC date&time
clock_settime(CLOCK_REALTIME, &stime);           // update system time

Of course, It should be better to provide an option to update RTC from system
time.

bye
mario


Re: Time managenet in QNX  
Dear Mario,

Could you please help me more about QNX RTC Utility? Are You mean QNX has
it's own utility for RTC time?

As you say I can update system time by RTC time and it is a better option
to update RTC time by system time vice versa, so OS can manage RTC time, I
mean when I use some commands like "Date" OS get direct access ti RTC and
respond the date by RTC time and date.

Are you have  an example of this? Is is applicable to do that in QNX?

Many thanks in advance
Amin

On Mon, Feb 22, 2016 at 10:42 AM, mario sangalli <community-noreply@qnx.com>
wrote:

> Amin, QNX, like other OS, has its own system timer :
>
> If You have an rtc, You must use it to update the system time, normally
> at  system boot up.
> You have to update the Qnx rtc utility including Your specific rtc chip
> support, or write
> your own utility.
>
> Anyway, basically You have to do:
> 1. Read out Your RTC time
> 2. Update the system time.
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Here a short example:
>
> struct timespec stime;
> get_my_rtc_time(&stime);                                           // read
> RTC date&time
> clock_settime(CLOCK_REALTIME, &stime);           // update system time
>
> Of course, It should be better to provide an option to update RTC from
> system
> time.
>
> bye
> mario
>
>
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post115824
> To cancel your subscription to this discussion, please e-mail
> ostech-core_os-unsubscribe@community.qnx.com
>



-- 
-----------------------------------------------------------------------
Amin Sahebi                             MAPNAEC
e-mail: sahebi.amin@gmail.com
e-mail: sahebi.amin@mapnaec.com
Fax:       +26-366-3802              MAPNAEC Co.
Phone:  +26-366-38001
website: www.mapnaec.com
Attachment: HTML sf-attachment-mime32500 3.95 KB
Re: Time managenet in QNX  
> Dear Mario,
> 
> Could you please help me more about QNX RTC Utility? Are You mean QNX has
> it's own utility for RTC time?
Yes, it has. see rtc utility in dcumentation (it has not changed from 6.3 to 6.5, I'm not sure
for 6.6)
>
> As you say I can update system time by RTC time and it is a better option
> to update RTC time by system time vice versa, so OS can manage RTC time, I
> mean when I use some commands like "Date" OS get direct access ti RTC and
> respond the date by RTC time and date.

Well , for what I known, the 'date' utility do not changes  the the rtc hardware, nor
read it automatically,  so You have to use the rtc utility to update Your chip.
 
> Are you have  an example of this? Is is applicable to do that in QNX?
rtc utility should be provided in the bsp source: see usr/utility/r/rtc.
Under Your board support (ie: src\hardware\startup\boards\myboard\rtc_time.c and
src\hardware\startup\boards\myboard\hw_rtc_xxxx.c)
You can find the implementation of rtc chip to use with rtc utility.

If You do not have such sources or You want a dedicated function, You can write Your rtc utility:
basically You must have to implements two options:
1. Read RTC hw and update system time
2. Read system time and update RTC
You You want an example of such utility let me know.
Cheers
Mario