LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-05-2003, 09:24 AM   #1
qmon2002
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Rep: Reputation: 0
Time based applicatioon


Hello all,

First, I would like to say that I'm new to programming and thank you for the help in advance.

I'm currently trying to develop and application in C++ that should start and play a song, for example, every few hours. What I want to know how to make to the application check for time, and based on the value received from the system to start or not.

Pointing to the right direction is much appreciated.

Thanks
 
Old 02-05-2003, 10:05 AM   #2
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
You are looking for libraries like <sys/time.h>, but where you get the information I don't know. It would probably be better suited for a scripting langauge like bash.
 
Old 02-05-2003, 10:11 AM   #3
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
My computer gets time from a Time Server at the local University. In that case a langauge like Java probably makes getting that information a lot easier than C++. You can probably to use libraries like <sys/time.h> but those are definately platform specific and not part of standard C or standard C++. They are libraries of the OS.
 
Old 02-05-2003, 10:31 AM   #4
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
There is also a <time.h> header. I have to do stuff this afternood but I can maybe help later if nobody else does. If you just want to play music as certain times though and nothing else than for sure a shell script would be better.
 
Old 02-05-2003, 10:43 AM   #5
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
Is the application a daemon?
 
Old 02-05-2003, 11:34 AM   #6
qmon2002
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks GTKUser for your help,

Well, I don't want to use a script to do such task.
I just want the the application to keep checking for time at a certain intervals during the 24 hours span, and when the time set by the user is equal to the time is on the system, a reminder is displayed.

Thanks again
 
Old 02-05-2003, 11:35 AM   #7
qmon2002
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Original Poster
Rep: Reputation: 0
It is going to be a KDE applet.
 
Old 02-05-2003, 11:48 AM   #8
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
Oh okay, so you are using QT and the program is a daemon. QT has specific libraries for dealing with system time. I have a book on QT with a chapter called Interfacing with the operating system. And one of the sections talks about working with date and time values.

Just reading the first few words:

Date and time values are inherently hard to make portable. Therefore, it's a good idea to use the classes provided by QT when you work with this kind of data.

Three QT classes are in this area: QDate, QTime, and QDateTime. ...

Look up those class prototypes.
 
  


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
Linux based gateway for time-based wireless service. TotalDefiance Linux - Software 0 10-03-2005 06:06 PM
Time Based Nat roopunix Linux - Networking 2 07-03-2005 08:59 AM
Time Based Nat roopunix Linux - Networking 1 07-03-2005 07:32 AM
Find files based on time. FinalFantasy Linux - Software 4 05-21-2004 07:25 PM
search based on time stamp ? massai Linux - Newbie 1 03-07-2004 02:50 PM

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

All times are GMT -5. The time now is 08:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration