LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-17-2003, 05:40 AM   #1
oskernel
LQ Newbie
 
Registered: Sep 2003
Location: China
Posts: 25

Rep: Reputation: 15
How to read the RTC ?


Can anybody wirte some code to read the RTC ?
 
Old 10-17-2003, 06:57 AM   #2
UltimaGuy
Member
 
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 32
I don't exactly get what you'r needs are. If you mean a C/C++ program to read the system time, I can do it.

Code:
#include <iostream>
#include <ctime>
using namespace std;

int main() {
   time_t t = time(0);
   cout << "The time is : " << ctime(t) << endl;

   return 0;
}
Type 'man ctime' in your terminal to get details about the various time structures.
 
Old 10-17-2003, 07:19 AM   #3
oskernel
LQ Newbie
 
Registered: Sep 2003
Location: China
Posts: 25

Original Poster
Rep: Reputation: 15
No.
I mean the hardware RTC.
 
Old 10-17-2003, 07:38 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
why, when Paul Gortmaker has done already, look in /usr/src/linux/Documentation/rtc.txt generally if you want to talk to a device driver then there will be some sort of documentation in /usr/src/linux/Documentation please at least look here before you post
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
missing /dev/rtc meres Linux - General 7 10-17-2005 01:37 PM
Not unknown problem with /dev/rtc carbono Linux - Newbie 1 10-13-2005 08:04 AM
Proc-rtc HeatSeaker Linux - Software 3 10-31-2004 08:50 AM
Change RTC with PROC? Mor_Petrus Programming 1 04-15-2003 12:14 PM
Two problems again.. Printer and RTC NSKL Slackware 4 08-14-2002 10:26 AM

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

All times are GMT -5. The time now is 04:18 PM.

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