You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					21 lines
				
				456 B
			
		
		
			
		
	
	
					21 lines
				
				456 B
			| 
								 
											6 years ago
										 
									 | 
							
								#include "stdafx.h"
							 | 
						||
| 
								 | 
							
								#include "Timer.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Timer::Timer()
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
									reset();
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// gets the time elapsed from construction.
							 | 
						||
| 
								 | 
							
								unsigned long long /*milliseconds*/ Timer::getTimePassed(){
							 | 
						||
| 
								 | 
							
									// get the new time
							 | 
						||
| 
								 | 
							
									auto end = std::chrono::time_point_cast<std::chrono::milliseconds>(clock::now());
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// return the difference of the times
							 | 
						||
| 
								 | 
							
									return (end - start).count();
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void Timer::reset() {
							 | 
						||
| 
								 | 
							
									start = std::chrono::time_point_cast<std::chrono::milliseconds>(clock::now());
							 | 
						||
| 
								 | 
							
								}
							 |