Click here to Skip to main content
15,916,180 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Monitor thread status Pin
George_George30-Jun-08 21:02
George_George30-Jun-08 21:02 
GeneralRe: Monitor thread status Pin
Saurabh.Garg30-Jun-08 21:27
Saurabh.Garg30-Jun-08 21:27 
GeneralRe: Monitor thread status Pin
George_George30-Jun-08 21:32
George_George30-Jun-08 21:32 
GeneralRe: Monitor thread status Pin
Saurabh.Garg30-Jun-08 21:45
Saurabh.Garg30-Jun-08 21:45 
GeneralRe: Monitor thread status Pin
George_George30-Jun-08 21:50
George_George30-Jun-08 21:50 
GeneralRe: Monitor thread status Pin
Hamid_RT1-Jul-08 20:37
Hamid_RT1-Jul-08 20:37 
GeneralRe: Monitor thread status Pin
George_George2-Jul-08 1:38
George_George2-Jul-08 1:38 
Questionstupid VC++ with timestamp Pin
tataxin30-Jun-08 16:27
tataxin30-Jun-08 16:27 
I have a dialog with 2 Date Time Picker.
The first is m_date with Short Date format
The second is m_time with Time format

CDateTimeCtrl dateBox; // Date Time Picker with Short Date format
CDateTimeCtrl timeBox; // Date Time Picker with Time format


Then I want to get the timestamp from them, the final result should be in __int64 (to compare with database and something else). An example is 1214878775000 for a SYSTEMTIME
wYear 2008
wMonth 7
wDayOfWeek
wDay 1
wHour 11
wMinute 19
wSecond 35
wMilliseconds 734

Try to look at the MSDN, there are many stupid things: CTime, SYSTEMTIME, FILETIME, .... blah blah .... with a alot of functions.
Is it really that difficult or I go the wrong way? Does anyone have some way to to this?

Here I got the result with a function like this way:
__int64 CMyDlg::getTimestamp()
{
	__int64 nTime;

	CTime tmpTime;
	int nYear, nMonth, nDay, nHour, nMin, nSec;

	dateBox.GetTime( tmpTime );
	nYear = tmpTime.GetYear(); nMonth = tmpTime.GetMonth(); nDay = tmpTime.GetDay();

	timeBox.GetTime( tmpTime );
	nHour = tmpTime.GetHour(); nMin = tmpTime.GetMinute(); nSec = tmpTime.GetSecond();

	CTime navTime( nYear, nMonth, nDay, nHour, nMin, nSec );

	SYSTEMTIME	ST;
	FILETIME	FT;

	navTime.GetAsSystemTime(ST);

	SystemTimeToFileTime(&ST,&FT);
	
	__int64 nSetTime;
	

	memcpy(&nSetTime, &FT, sizeof(FILETIME));

	MyFormatter formatter;
	
	nTime = formatter.FileTimeToJavaTime(nSetTime);

	nTime -= 9 * 60 * 60* 1000;

	return nTime;
}


It use another class MyFormatter that I cannot understand. I really hate these stupid stuff !!! Mad | :mad:
Does anyone have a simple way to get timestamp?

Thank you in advance,
QuestionRe: stupid VC++ with timestamp Pin
David Crow30-Jun-08 17:20
David Crow30-Jun-08 17:20 
QuestionRe: stupid VC++ with timestamp [modified] Pin
tataxin30-Jun-08 19:07
tataxin30-Jun-08 19:07 
AnswerRe: stupid VC++ with timestamp Pin
David Crow1-Jul-08 3:33
David Crow1-Jul-08 3:33 
GeneralRe: stupid VC++ with timestamp Pin
tataxin1-Jul-08 16:37
tataxin1-Jul-08 16:37 
RantRe: stupid VC++ with timestamp Pin
Alan Balkany1-Jul-08 4:54
Alan Balkany1-Jul-08 4:54 
GeneralRe: stupid VC++ with timestamp Pin
tataxin1-Jul-08 16:40
tataxin1-Jul-08 16:40 
AnswerRe: stupid VC++ with timestamp Pin
kcynic30-Jun-08 17:27
kcynic30-Jun-08 17:27 
QuestionRe: stupid VC++ with timestamp Pin
tataxin30-Jun-08 18:53
tataxin30-Jun-08 18:53 
AnswerRe: stupid VC++ with timestamp Pin
kcynic30-Jun-08 19:27
kcynic30-Jun-08 19:27 
GeneralRe: stupid VC++ with timestamp Pin
tataxin30-Jun-08 19:45
tataxin30-Jun-08 19:45 
GeneralRe: stupid VC++ with timestamp [modified] Pin
kcynic1-Jul-08 17:05
kcynic1-Jul-08 17:05 
QuestionSDI Application with a Tabview Pin
godspeed12330-Jun-08 13:52
godspeed12330-Jun-08 13:52 
AnswerRe: SDI Application with a Tabview Pin
theCPkid30-Jun-08 19:08
theCPkid30-Jun-08 19:08 
Questionapplication settings window in xp/vista Pin
garyofcourse30-Jun-08 10:10
garyofcourse30-Jun-08 10:10 
AnswerRe: application settings window in xp/vista Pin
_AnsHUMAN_ 30-Jun-08 19:09
_AnsHUMAN_ 30-Jun-08 19:09 
QuestionDisplaying 3D interface on multiple platforms Pin
Dustin Henry30-Jun-08 8:17
Dustin Henry30-Jun-08 8:17 
AnswerRe: Displaying 3D interface on multiple platforms Pin
Nemanja Trifunovic30-Jun-08 9:36
Nemanja Trifunovic30-Jun-08 9:36 

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.