Skip to content
Snippets Groups Projects
Select Git revision
  • ca04e9ab798bc1fbaaa3b1274547a7c74764c4ad
  • master default protected
  • main
  • test-refactor-server-json
  • blender-v4.1-release
  • blender-v4.0-release
  • blender-v3.6-release
  • blender-v3.3-release
  • blender-v2.93-release
  • blender-v3.5-release
  • blender-v3.1-release
  • blender-v3.0-release
  • blender-v3.4-release
  • blender-v3.2-release
  • studio-sprite-fright
  • blender-v2.92-release
  • blender-v2.91-release
  • greasepencil-addon
  • blender-v2.90-release
  • blender-v2.83-release
  • blender-v2.82-release
  • v3.6.9
  • v3.3.16
  • v4.1.0
  • v4.1.1
  • v3.6.8
  • v3.3.15
  • v3.6.7
  • v3.3.14
  • v4.0.2
  • v4.0.1
  • v4.0.0
  • v3.6.5
  • v3.3.12
  • v3.6.4
  • v3.6.3
  • v3.3.11
  • v3.6.2
  • v3.3.10
  • v3.6.1
  • v3.3.9
41 results

mesh_select_checkered.py

Blame
  • timer.h 1.21 KiB
    #pragma once
    
    #include <chrono>
    
    class timer
    {
    private:
    	std::chrono::steady_clock::duration total_duration;
    	std::chrono::steady_clock::duration lap_duration;
    	std::chrono::steady_clock::time_point start_point;
    	static constexpr double ticks_to_sec = ((double)std::chrono::steady_clock::period::num) / std::chrono::steady_clock::period::den; // duration of one tick
    public:
    	timer(bool start = false)
    	{
    		this->reset();
    
    		if(start)
    			this->start();
    	}
    
    	void start()
    	{
    		this->start_point = std::chrono::steady_clock::now();
    	}
    
    	void stop()
    	{
    		auto stop_point = std::chrono::steady_clock::now();
    		this->lap_duration = stop_point - start_point;
    		this->total_duration += this->lap_duration;
    	}
    
    	void reset()
    	{
    		this->total_duration = std::chrono::steady_clock::duration(0);
    		this->lap_duration = std::chrono::steady_clock::duration(0);
    	}
    
    	std::chrono::steady_clock::duration get_lap_duration() const
    	{
    		return this->lap_duration;
    	}
    
    	std::chrono::steady_clock::duration get_total_duration() const
    	{
    		return this->total_duration;
    	}
    
    	double get_lap_time() const
    	{
    		return (double)this->lap_duration.count() * ticks_to_sec;
    	}
    
    	double get_total_time() const
    	{
    		return this->total_duration.count() * ticks_to_sec;
    	}
    };