Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert from char to CString. for Time and Date

Status
Not open for further replies.

TheMillionDollarMan

Programmer
Jun 10, 2002
132
US
How can I do this?

I want to getthe time and date from when a process starts to when it finishes.

char charDate ;
char charTimeStart;
_strdate( charDate );
_strtime( charTimeStart );

Process....

char charDate2 ;
char charTime2;
_strdate( charDate2 );
_strtime( charTimeEnd2 );

But I want to compare before and after the process (ie difference in Time).


To do this I have tried
intTime = (int)charTimeStart;
But this doesn retrun anything meaningful.


Thanks
D

 
Use what you already have to display the beginning and end times. To get the difference, use the following, which will give you the difference between the two in seconds:
Code:
time_t begin_time;
time_t end_time;
double elapsed_seconds;

  time(&begin_time);

  // do your work

  time(&end_time);

  elapsed_seconds = difftime(end_time, begin_time);
Hope this helps...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top