473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Time

im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function

can anyone help please??

thanx michael
Jul 22 '05 #1
8 1818

Michael <mi*********@blueyonder.co.uk> wrote in message
news:CV*******************@fe2.news.blueyonder.co. uk...
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function

can anyone help please??

thanx michael

Jul 22 '05 #2
Michael writes:
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function


Sorry for the blank post.

C++ comes with functions cclock() and ctime() which may be helpful. But
your particular compiler may have something better which probably has
"sleep" somehow suggested by the name. So if you don't like cclock or ctime
and you can't find anything better with that hint, post to a newsgroup for
your particular compiler.
Jul 22 '05 #3
Michael wrote:
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function

can anyone help please??


Apart from the standard facilities provided by the compiler (as
mentioned in the previous post), you may find other facilities provided
by the OS might be more interesting.

Unix has an "alarm" method that will cause a signal to be sent as well
as various other timer facilities.

If you don't need asynchronous timing, you mat be able to use the
"select" or "poll" system calls that allow you to both wait on input and
a timeout.

All of these facilities require quite a significant understanding of how
they interact with the C++ library - not somthing a beginner will find
trivial.
Jul 22 '05 #4
its dev-cpp the beta version

but thanx ill give it a try

"osmium" <r1********@comcast.net> wrote in message
news:2p************@uni-berlin.de...
Michael writes:
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function
Sorry for the blank post.

C++ comes with functions cclock() and ctime() which may be helpful. But
your particular compiler may have something better which probably has
"sleep" somehow suggested by the name. So if you don't like cclock or

ctime and you can't find anything better with that hint, post to a newsgroup for
your particular compiler.

Jul 22 '05 #5

"osmium" <r1********@comcast.net> wrote in message
news:2p************@uni-berlin.de...
Michael writes:
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function


Sorry for the blank post.

C++ comes with functions cclock() and ctime()


That's clock() and time(). Declared by header <ctime>
(or <time.h>).

-Mike
Jul 22 '05 #6
wut do i write in the brackets??

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:CD****************@newsread2.news.pas.earthli nk.net...

"osmium" <r1********@comcast.net> wrote in message
news:2p************@uni-berlin.de...
Michael writes:
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function


Sorry for the blank post.

C++ comes with functions cclock() and ctime()


That's clock() and time(). Declared by header <ctime>
(or <time.h>).

-Mike

Jul 22 '05 #7

"Michael" <mi*********@blueyonder.co.uk> wrote in message
news:1V*******************@fe2.news.blueyonder.co. uk...
wut do i write in the brackets??


[Please don't top post.] What do you mean by
your question? Do you mean "how do I use those
functions?" If so, you need a standard library
reference so you can look them up. This could
be from a textbook or from your compiler documentation.
For C++ books, see www.accu.org for reviews and
recommendations.

-Mike
Jul 22 '05 #8
Michael wrote:
wut do i write in the brackets??

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:CD****************@newsread2.news.pas.earthli nk.net...
"osmium" <r1********@comcast.net> wrote in message
news:2p************@uni-berlin.de...
Michael writes:
im new to this c++ programming
im making a game and need to workout how to do certain things like run
functions at a certain time after the program has run
eg after 10 seconds run the pen function

Sorry for the blank post.

C++ comes with functions cclock() and ctime()


That's clock() and time(). Declared by header <ctime>
(or <time.h>).

-Mike


There are two levels of granularities here - in terms of seconds and
clocks.

CLK_TCK macro would get the number of clock ticks per second.

So depending on your profiling necessity, you can choose from one of
the two.

Aliter:
This link might be helpful ..

http://www.cplusplus.com/ref/ctime/ .
--
Karthik.
Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bart Nessux | last post by:
am I doing this wrong: print (time.time() / 60) / 60 #time.time has been running for many hours if time.time() was (21600/60) then that would equal 360/60 which would be 6, but I'm not getting...
5
by: David Stockwell | last post by:
I'm sure this has been asked before, but I wasn't able to find it. First off I know u can't change a tuple but if I wanted to increment a time tuple by one day what is the standard method to do...
6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
3
by: Szabolcs Nagy | last post by:
I have to measure the time of a while loop, but with time.clock i always get 0.0s, although python manual sais: "this is the function to use for benchmarking Python or timing algorithms" So i...
6
by: Rebecca Smith | last post by:
Today’s question involves two time text boxes each set to a different time zone. Initially txtCurrentTime will be set to Pacific Time or system time. This will change with system time as we travel...
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
3
by: cj | last post by:
If I want to check to see if it's after "11:36 pm" what would I write? I'm sure it's easy but I'm getting tired of having to work with dates and times. Sometimes I just want time or date. And...
1
by: davelist | last post by:
I'm guessing there is an easy way to do this but I keep going around in circles in the documentation. I have a time stamp that looks like this (corresponding to UTC time): start_time =...
2
by: Roseanne | last post by:
We are experiencing very slow response time in our web app. We run IIS 6 - windows 2003. I ran iisstate. Here's what I got. Any ideas?? Opened log file 'F:\iisstate\output\IISState-812.log'...
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.