public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] clock_settime() help
@ 2004-10-28 17:39 Jay Foster
  2004-10-28 21:20 ` Sam Pham
  0 siblings, 1 reply; 5+ messages in thread
From: Jay Foster @ 2004-10-28 17:39 UTC (permalink / raw)
  To: 'Sam Pham', eCos Discuss

Perhaps you should use cyg_libc_time_settime() instead.  I have not had any
problems using this to set the system time of day.  This does require a
wallclock package to be included in your configuration
(CYGPKG_IO_WALLCLOCK).  You can use the default wallclock emulation device.
Jay

-----Original Message-----
From: Sam Pham [mailto:anhmn@yahoo.com]
Sent: Thursday, October 28, 2004 9:55 AM
To: eCos Discuss
Subject: [ECOS] clock_settime() help


Hi all,

I'm having trouble with calling the clock_settime()
function.  My application has the need of setting the
clock to the current time.  At first, I called
clock_settime() inside my ISR, and then outside of
this ISR, I called clock_gettime() to verify if the
current time was set.  I noticed that sometimes
clock_settime() failed because clock_gettime()
returned a non-current time value.  So I decided to
call clock_settime() in a thread with all interrupts
disabled by calling function cyg_interrupt_disable(). 
However, I still observed the same failure as before.

Could anyone explain to me how I should be using
function clock_settime()?  Its implementation is very
simple - just change the counter value.  However, it
looks like if the kernel is in certain states, then it
won't allow anything to change this counter value.

Thanks.


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] clock_settime() help
  2004-10-28 17:39 [ECOS] clock_settime() help Jay Foster
@ 2004-10-28 21:20 ` Sam Pham
  2004-10-29 10:00   ` sandeep
  0 siblings, 1 reply; 5+ messages in thread
From: Sam Pham @ 2004-10-28 21:20 UTC (permalink / raw)
  To: Jay Foster, eCos Discuss

Thanks for your response.  My application needs to
have timestamp of milli-seconds resolution.  Wallclock
is only seconds.


--- Jay Foster <jay.foster@systech.com> wrote:

> Perhaps you should use cyg_libc_time_settime()
> instead.  I have not had any
> problems using this to set the system time of day. 
> This does require a
> wallclock package to be included in your
> configuration
> (CYGPKG_IO_WALLCLOCK).  You can use the default
> wallclock emulation device.
> Jay
> 
> -----Original Message-----
> From: Sam Pham [mailto:anhmn@yahoo.com]
> Sent: Thursday, October 28, 2004 9:55 AM
> To: eCos Discuss
> Subject: [ECOS] clock_settime() help
> 
> 
> Hi all,
> 
> I'm having trouble with calling the clock_settime()
> function.  My application has the need of setting
> the
> clock to the current time.  At first, I called
> clock_settime() inside my ISR, and then outside of
> this ISR, I called clock_gettime() to verify if the
> current time was set.  I noticed that sometimes
> clock_settime() failed because clock_gettime()
> returned a non-current time value.  So I decided to
> call clock_settime() in a thread with all interrupts
> disabled by calling function
> cyg_interrupt_disable(). 
> However, I still observed the same failure as
> before.
> 
> Could anyone explain to me how I should be using
> function clock_settime()?  Its implementation is
> very
> simple - just change the counter value.  However, it
> looks like if the kernel is in certain states, then
> it
> won't allow anything to change this counter value.
> 
> Thanks.
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We
> finish.
> http://promotions.yahoo.com/new_mail 
> 
> -- 
> Before posting, please read the FAQ:
> http://ecos.sourceware.org/fom/ecos
> and search the list archive:
> http://ecos.sourceware.org/ml/ecos-discuss
> 
> -- 
> Before posting, please read the FAQ:
> http://ecos.sourceware.org/fom/ecos
> and search the list archive:
> http://ecos.sourceware.org/ml/ecos-discuss
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] clock_settime() help
  2004-10-28 21:20 ` Sam Pham
@ 2004-10-29 10:00   ` sandeep
  2004-11-01 16:08     ` Sam Pham
  0 siblings, 1 reply; 5+ messages in thread
From: sandeep @ 2004-10-29 10:00 UTC (permalink / raw)
  To: Sam Pham; +Cc: Jay Foster, eCos Discuss

Sam Pham wrote:

>>clock to the current time.  At first, I called
>>clock_settime() inside my ISR, and then outside of
>>this ISR, I called clock_gettime() to verify if the
>>current time was set.  I noticed that sometimes
>>clock_settime() failed because clock_gettime()
>>returned a non-current time value.  So I decided to
>>call clock_settime() in a thread with all interrupts
>>disabled by calling function
>>cyg_interrupt_disable(). 
>>However, I still observed the same failure as
>>before.

some very dumb questions -

- what do you mean by that clock_settime failed??
- when you say "clock_gettime()returned a non-current time value", you mean it 
returned a value lesser or more than current time?
- how do you find current time? is your order
   clock_gettime
   get current time
   compare them
OR
   get current time
   clock_gettime
   compare them

- if above are your steps, have you tried doing these under disabled interrupts 
and found same results? i am not talking of clock_settime with disabled 
interrupts, here.

sandeep


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] clock_settime() help
  2004-10-29 10:00   ` sandeep
@ 2004-11-01 16:08     ` Sam Pham
  0 siblings, 0 replies; 5+ messages in thread
From: Sam Pham @ 2004-11-01 16:08 UTC (permalink / raw)
  To: sandeep; +Cc: Jay Foster, eCos Discuss

Thanks for your response.  I've found the bug in my SW
that causes clock_settime() to fail at times.  I
didn't normalize the nanosecond field before calling
this function (e.g. if number of nanoseconds >
1000000000, then I need to increment number of seconds
by 1 and decrement number of nanoseconds by
1000000000).


--- sandeep <shimple0@yahoo.com> wrote:

> Sam Pham wrote:
> 
> >>clock to the current time.  At first, I called
> >>clock_settime() inside my ISR, and then outside of
> >>this ISR, I called clock_gettime() to verify if
> the
> >>current time was set.  I noticed that sometimes
> >>clock_settime() failed because clock_gettime()
> >>returned a non-current time value.  So I decided
> to
> >>call clock_settime() in a thread with all
> interrupts
> >>disabled by calling function
> >>cyg_interrupt_disable(). 
> >>However, I still observed the same failure as
> >>before.
> 
> some very dumb questions -
> 
> - what do you mean by that clock_settime failed??
> - when you say "clock_gettime()returned a
> non-current time value", you mean it 
> returned a value lesser or more than current time?
> - how do you find current time? is your order
>    clock_gettime
>    get current time
>    compare them
> OR
>    get current time
>    clock_gettime
>    compare them
> 
> - if above are your steps, have you tried doing
> these under disabled interrupts 
> and found same results? i am not talking of
> clock_settime with disabled 
> interrupts, here.
> 
> sandeep
> 
> 
> -- 
> Before posting, please read the FAQ:
> http://ecos.sourceware.org/fom/ecos
> and search the list archive:
> http://ecos.sourceware.org/ml/ecos-discuss
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS] clock_settime() help
  2004-10-25 14:55 [ECOS] posix time functions Nick Garnett
@ 2004-10-28 17:25 ` Sam Pham
  0 siblings, 0 replies; 5+ messages in thread
From: Sam Pham @ 2004-10-28 17:25 UTC (permalink / raw)
  To: eCos Discuss

Hi all,

I'm having trouble with calling the clock_settime()
function.  My application has the need of setting the
clock to the current time.  At first, I called
clock_settime() inside my ISR, and then outside of
this ISR, I called clock_gettime() to verify if the
current time was set.  I noticed that sometimes
clock_settime() failed because clock_gettime()
returned a non-current time value.  So I decided to
call clock_settime() in a thread with all interrupts
disabled by calling function cyg_interrupt_disable(). 
However, I still observed the same failure as before.

Could anyone explain to me how I should be using
function clock_settime()?  Its implementation is very
simple - just change the counter value.  However, it
looks like if the kernel is in certain states, then it
won't allow anything to change this counter value.

Thanks.


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-01 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 17:39 [ECOS] clock_settime() help Jay Foster
2004-10-28 21:20 ` Sam Pham
2004-10-29 10:00   ` sandeep
2004-11-01 16:08     ` Sam Pham
  -- strict thread matches above, loose matches on Subject: below --
2004-10-25 14:55 [ECOS] posix time functions Nick Garnett
2004-10-28 17:25 ` [ECOS] clock_settime() help Sam Pham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).