Sha256: 649d4561854ee6056b16d6b584552ceb7f9b22fcaaeeb9df5b28edb458eba421

Contents?: true

Size: 434 Bytes

Versions: 34

Compression:

Stored size: 434 Bytes

Contents

#include "xot/time.h"


#include <chrono>
#include <thread>


namespace Ch = std::chrono;


namespace Xot
{


	double
	time ()
	{
		auto now = Ch::system_clock::now().time_since_epoch();
		return Ch::duration_cast<Ch::milliseconds>(now).count() / 1000.0;
	}

	void
	sleep (double seconds)
	{
		if (seconds <= 0) return;

		long long millisecs = seconds * 1000;
		std::this_thread::sleep_for(Ch::milliseconds(millisecs));
	}


}// Xot

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
xot-0.3.3 src/time.cpp
xot-0.3.2 src/time.cpp
xot-0.3.1 src/time.cpp
xot-0.3 src/time.cpp
xot-0.2.1 src/time.cpp
xot-0.2 src/time.cpp
xot-0.1.42 src/time.cpp
xot-0.1.41 src/time.cpp
xot-0.1.40 src/time.cpp
xot-0.1.39 src/time.cpp
xot-0.1.38 src/time.cpp
xot-0.1.37 src/time.cpp
xot-0.1.36 src/time.cpp
xot-0.1.35 src/time.cpp
xot-0.1.34 src/time.cpp
xot-0.1.33 src/time.cpp
xot-0.1.32 src/time.cpp
xot-0.1.31 src/time.cpp
xot-0.1.30 src/time.cpp
xot-0.1.29 src/time.cpp