cpp/0_check/johnstonc_programmingtoday_sourcecode/chapter09_classesobjects/ch9_settime/ch.cpp
//Demonstrates two ways to access the computer system time.

Demonstrates two ways to access the computer system time.
Demonstrates two ways to access the computer system time .
void SetTimeObject(Time *pWatch)
{
	char time_right_now[20];   
	_strtime(time_right_now);  
	cout << "\n The system time is " << time_right_now ; 
	time_t SystemTime;         
	time(&SystemTime);  
	struct tm *OStime;      
	OStime = localtime(&SystemTime);  
	pWatch->Reset(OStime->tm_hour, OStime->tm_min,OStime->tm_sec);
}
void SetTimeObject ( Time * pWatch ) { char time_right_now [ 20 ] ; _strtime ( time_right_now ) ; cout << " \n " << time_right_now ; time_t SystemTime ; time ( & SystemTime ) ; struct tm * OStime ; OStime = localtime ( & SystemTime ) ; pWatch -> Reset ( OStime -> tm_hour , OStime -> tm_min , OStime -> tm_sec ) ; }
Demonstrates two ways to access the computer system time.
Demonstrates two ways to access the computer system time .
// char string for time
 // The _strtime function fills a character string with the system time.
 // First, place system time in character string
 // We need to get integer values for hr, min, sec. 
 // Need to use a time_t struct that is defined in time.h
 // UTC time format variable
 // Passing the address of SystemTime to time function. 
 // The time function fills the SystemTime with UTC seconds
 // Need to convert UTC to something we can use.
 // The localtime function does that.
 // Declare struct tm ptr to hold individual time info
 // Pass the address of SystemTime to localtime to convert to tm struc
 // and it fills OStime with all we need.
 /* Now we can access the hr, min, sec of system time, and 
send them to the object's Reset function. (whew)  
The tm struct has tm_hour, tm_min and tm_sec variables. */