LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2003, 12:36 AM   #1
kernelpanicguy
LQ Newbie
 
Registered: Jul 2003
Posts: 11

Rep: Reputation: 0
help using rtc as a more accurate replacement for python's 'sleep' function


Does anyone know how to access the hardware (rtc) clock on linux?
I writing a program in python that needs to perform an operation and then sleep for an exact amount of time. Right now I have it using python's 'sleep' function which isn't always accurate enough.

As I understand it, the real-time clock(rtc) can be set to send a signal (like a new line or something) after a given amount of time. This sounds like the perfect solution to my problem.

I know the rtc has been used by C programs, but my program is written in python and I don't know much about C. I've looked at rtc.h for the symbols involved in interacting with the rtc, and I wrote a quick python script that tested values that wouldn't cause python's ioctl function to raise an exception when setting them on the rtc, and through that I have figured out the values to at least some of the symbols (RTC_UIE_ON/OFF i think). But I can't get it to work.


I really don't know what I'm doing and could use some help on this one.

All I need is a python script that:
-opens /dev/rtc
-sets the timer to signal every (30th of a second)
-waits for the signal (which should be recieved every 30th of a second) and does this forever

thanx
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching for Server (BOOTP/DHCP) <sleep> <sleep> .. .. Eileen Linux - Networking 12 10-21-2005 01:14 AM
How to disable the Monitor Sleep function under RH9 ?? 242VDM242 Linux - Newbie 1 05-21-2005 01:51 PM
looking for a Sleep() function Mike Davies Linux - Software 2 10-25-2004 08:11 AM
Is the wait function is the same as the sleep function ? Linh Programming 3 04-28-2004 12:39 PM
java's sockets or python's friendlier to use? Dominik Programming 2 03-06-2004 06:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration