ts-7000
[Top] [All Lists]

Re: [ts-7000] Re:TS7250 ..RTC

To:
Subject: Re: [ts-7000] Re:TS7250 ..RTC
From: Markus Peuhkuri <>
Date: Wed, 27 Dec 2006 08:08:20 +0200
Laks wrote:
> Hi
> how can i use the hwclock in my c source code?
> i need the time for my smart card reader which i am designing using the
> arm board

You won't need to read hwclock to get wall clock time. Use
gettimeofday() function to get current time (seconds since 1970-01-01
and microseconds) and  then strftime if you need to format it in text
format.  See 'man gettimeofday'.  You do not need to care about hwclock
as soon as your system has proper startup and shutdown scripts.

In normal Linux operation (also most other OSs too), the hwclock is read
only at boot time and after that the operating system keeps time
independently from real-time clock.  If you have network connectivity,
you may want to use ntp protocol to keep time in sync.

Thus normal operation would be:

- system is powered up
- in init scripts
  - the RTC clock is read and kernel knows current time
  - ntpdate is used to syncronise clocks, if possible after network
    is configured
  - ntp-client daemon is started that helps kernel to keep time (if you
    are low with resources, you may not want to use ntp-daemon but to
    run ntpdate every now and then using cron)
- your system does what ever you design it to do
- when system is shut down, current time is saved to realtime clock
  (you may want to update RTC every now and then if you use ntp(date),
  like daily with cron:
  'ntpdate your.ntp.server.example && hwclock --systohc')

-- 
Markus



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU