Click here to Skip to main content
15,902,715 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: convertion of a count to DateTime format Pin
John R. Shaw25-Dec-04 7:52
John R. Shaw25-Dec-04 7:52 
I assume you want to include milliseconds in the time display; otherwise this does not make since.

void MyStartTimer()
{
	time_t t1, t2;
	t1 = t2 = time(NULL);
	while( t1 == t2 ) // wait for start of next second
		t2 = time(NULL);
	m_timeStart = t2;
	// START YOUR TIMER HERE
	// m_dwTimeCount
}

BOOL MyGetDateTime(struct tm* ptm, unsigned* pMilliseconds)
{
	time_t timeEnd = time(NULL);
	time_t seconds = m_dwTimeCount / 1000L; // rounds down
	*pMilliseconds = m_dwTimeCount - (seconds * 1000L);
	struct tm* ptmLocal = localtime(&timeEnd);
	if( ptmLocal )
	{
		memcpy(ptm, ptmLocal, sizeof(struct tm));
		return TRUE;
	}
	return FALSE;
}

Oh well, something like that should work. The actual formating is up to you.


INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
GeneralA template question Pin
ThatsAlok24-Dec-04 1:14
ThatsAlok24-Dec-04 1:14 
GeneralRe: A template question Pin
Michael Dunn24-Dec-04 12:28
sitebuilderMichael Dunn24-Dec-04 12:28 
GeneralRe: A template question Pin
ThatsAlok25-Dec-04 16:25
ThatsAlok25-Dec-04 16:25 
GeneralToolbar (URGENT) Pin
24-Dec-04 0:29
suss24-Dec-04 0:29 
GeneralKeyboard Input - MFC Pin
sweep12324-Dec-04 0:27
sweep12324-Dec-04 0:27 
GeneralRe: Keyboard Input - MFC Pin
Abin24-Dec-04 15:09
Abin24-Dec-04 15:09 
GeneralRe: Keyboard Input - MFC Pin
Grahamfff25-Dec-04 22:50
Grahamfff25-Dec-04 22:50 
Generalhtmlhelp visual studio .net Pin
tiziacaia24-Dec-04 0:09
tiziacaia24-Dec-04 0:09 
GeneralRe: htmlhelp visual studio .net Pin
Alex Korchemniy24-Dec-04 10:08
Alex Korchemniy24-Dec-04 10:08 
GeneralRe: htmlhelp visual studio .net Pin
tiziacaia24-Dec-04 16:07
tiziacaia24-Dec-04 16:07 
GeneralRe: htmlhelp visual studio .net Pin
Anonymous24-Dec-04 19:30
Anonymous24-Dec-04 19:30 
QuestionHow to access Window Procedure of another processes window Pin
User 21559723-Dec-04 23:48
User 21559723-Dec-04 23:48 
QuestionWhy I can't run my app. on Win XP? Pin
ArielR23-Dec-04 23:36
ArielR23-Dec-04 23:36 
AnswerRe: Why I can't run my app. on Win XP? Pin
Aamir Butt23-Dec-04 23:39
Aamir Butt23-Dec-04 23:39 
GeneralRe: Why I can't run my app. on Win XP? Pin
ArielR23-Dec-04 23:45
ArielR23-Dec-04 23:45 
GeneralRe: Why I can't run my app. on Win XP? Pin
Steve S24-Dec-04 0:58
Steve S24-Dec-04 0:58 
GeneralRe: Why I can't run my app. on Win XP? Pin
ArielR28-Dec-04 2:25
ArielR28-Dec-04 2:25 
Generalfstream problem Pin
Imtiaz Murtaza23-Dec-04 23:01
Imtiaz Murtaza23-Dec-04 23:01 
GeneralRe: fstream problem Pin
Andrew Walker24-Dec-04 1:06
Andrew Walker24-Dec-04 1:06 
QuestionHow to display a Message when click on a Edit Box Scroll bar ? Pin
pubududilena23-Dec-04 22:17
pubududilena23-Dec-04 22:17 
AnswerRe: How to display a Message when click on a Edit Box Scroll bar ? Pin
Aamir Butt23-Dec-04 22:31
Aamir Butt23-Dec-04 22:31 
GeneralRe: How to display a Message when click on a Edit Box Scroll bar ? Pin
pubududilena23-Dec-04 22:40
pubududilena23-Dec-04 22:40 
Questioncan i make command buttons in vc++(like vb) Pin
siva_nkl3323-Dec-04 21:47
siva_nkl3323-Dec-04 21:47 
AnswerRe: can i make command buttons in vc++(like vb) Pin
ThatsAlok23-Dec-04 22:47
ThatsAlok23-Dec-04 22:47 

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.