Click here to Skip to main content
15,889,839 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Service access file on network folder Pin
sashoalm18-May-10 7:45
sashoalm18-May-10 7:45 
Questionmake a timer Pin
hasani200717-May-10 23:05
hasani200717-May-10 23:05 
AnswerRe: make a timer Pin
Rajesh R Subramanian17-May-10 23:26
professionalRajesh R Subramanian17-May-10 23:26 
JokeRe: make a timer Pin
CPallini17-May-10 23:45
mveCPallini17-May-10 23:45 
AnswerRe: make a timer Pin
Maximilien18-May-10 0:30
Maximilien18-May-10 0:30 
GeneralRe: make a timer Pin
Stephen Hewitt18-May-10 0:35
Stephen Hewitt18-May-10 0:35 
AnswerRe: make a timer Pin
KarstenK18-May-10 1:26
mveKarstenK18-May-10 1:26 
AnswerRe: Here is your count down timer hasani2007 Pin
Software_Developer18-May-10 7:31
Software_Developer18-May-10 7:31 
Sir, Here is your timer hasani2007. Its in 'dirty c code', clean it up.
set the variable count_down_time_in_secs in seconds for desired count down time.
The Code is self explanatory.

1 minute = 60 secs
5 minutes = 60x5 secs
30 minutes =60x30 secs
1 hour = 60x60 secs


#include <stdio.h>
#include <time.h>

 
int main ()
{
	 
	 
	unsigned int x_hours=0;
	unsigned int x_minutes=0;
	unsigned int x_seconds=0;
	unsigned int x_milliseconds=0;
	unsigned int totaltime=0,count_down_time_in_secs=0,time_left=0;

	clock_t x_startTime,x_countTime;
	count_down_time_in_secs=10;  // 1 minute is 60, 1 hour is 3600

 
    x_startTime=clock();  // start clock
    time_left=count_down_time_in_secs-x_seconds;   // update timer

	while (time_left>0) 
	{
		x_countTime=clock(); // update timer difference
		x_milliseconds=x_countTime-x_startTime;
		x_seconds=(x_milliseconds/(CLOCKS_PER_SEC))-(x_minutes*60);
		x_minutes=(x_milliseconds/(CLOCKS_PER_SEC))/60;
		x_hours=x_minutes/60;


	 

		time_left=count_down_time_in_secs-x_seconds; // subtract to get difference 


		printf( "\nYou have %d seconds left ( %d ) count down timer by TopCoder 

",time_left,count_down_time_in_secs);
	}


	printf( "\n\n\nTime's out\n\n\n");

return 0;
}

.
.
.

TopCoder
GeneralRe: Here is your count down timer hasani2007 Pin
Stephen Hewitt18-May-10 14:04
Stephen Hewitt18-May-10 14:04 
AnswerRe: make a timer Pin
Aescleal19-May-10 5:49
Aescleal19-May-10 5:49 
Questionrecursive function Pin
hasani200717-May-10 22:26
hasani200717-May-10 22:26 
AnswerRe: recursive function Pin
CPallini17-May-10 22:45
mveCPallini17-May-10 22:45 
QuestionRe: recursive function Pin
David Crow19-May-10 3:52
David Crow19-May-10 3:52 
Questionsingel document app cannot recieve WM_KEYDOWN event Pin
dnqhung17-May-10 21:00
dnqhung17-May-10 21:00 
AnswerRe: singel document app cannot recieve WM_KEYDOWN event Pin
Aescleal18-May-10 5:12
Aescleal18-May-10 5:12 
GeneralRe: singel document app cannot recieve WM_KEYDOWN event Pin
dnqhung18-May-10 15:33
dnqhung18-May-10 15:33 
GeneralRe: singel document app cannot recieve WM_KEYDOWN event Pin
Aescleal18-May-10 22:38
Aescleal18-May-10 22:38 
GeneralRe: singel document app cannot recieve WM_KEYDOWN event Pin
dnqhung21-May-10 15:57
dnqhung21-May-10 15:57 
QuestionObtaining the version info of external app [solved] Pin
PaulowniaK17-May-10 19:43
PaulowniaK17-May-10 19:43 
AnswerRe: Obtaining the version info of external app Pin
Stephen Hewitt17-May-10 20:42
Stephen Hewitt17-May-10 20:42 
GeneralRe: Obtaining the version info of external app Pin
PaulowniaK17-May-10 20:50
PaulowniaK17-May-10 20:50 
QuestionProblem with CreateFileMapping() window7/Vista. Pin
janaswamy uday17-May-10 19:41
janaswamy uday17-May-10 19:41 
AnswerRe: Problem with CreateFileMapping() window7/Vista. Pin
hanq_3891013017-May-10 20:59
hanq_3891013017-May-10 20:59 
AnswerRe: Problem with CreateFileMapping() window7/Vista. Pin
Richard MacCutchan17-May-10 21:37
mveRichard MacCutchan17-May-10 21:37 
Questionaudio chat Pin
69917-May-10 17:24
69917-May-10 17:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.