#include <Windows.h>
#include <Winbase.h>
namespace sprawl
{
namespace time
{
static int64_t GetPerformanceFrequency()
{
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
return frequency.QuadPart;
}
static int64_t s_performanceFrequency = GetPerformanceFrequency();
int64_t Now(Resolution resolution)
{
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
uint64_t tt = ft.dwHighDateTime;
tt <<=32;
tt |= ft.dwLowDateTime;
tt -= 116444736000000000ULL;
tt *= 100;
return int64_t(tt) / std::underlying_type<Resolution>::type(resolution);
}
int64_t SteadyNow(Resolution resolution)
{
LARGE_INTEGER time;
QueryPerformanceCounter(&time);
double nanoseconds = time.QuadPart * double(Resolution::Seconds);
nanoseconds /= s_performanceFrequency;
return int64_t(nanoseconds / std::underlying_type<Resolution>::type(resolution));
}
}
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 13650 | ShadauxCat |
- Windows implementations of thread and time libraries - Added coroutines - Added some more unit tests, fixed some unit tests in windows environments - Fixed an issue where multi threading was not properly detected on Linux - Fixed the makefiles to build with threading by default on linux - Changed the pool allocator to use thread-local pools instead of locking mutexes - Fixed output of sprawl::string in the StringBuilder library to take length into account - Added string builder options for StringLiteral - Added thread local implementation #review |
||
| #1 | 11500 | ShadauxCat |
Added sprawl::time library. Fixed JSON Unit Test bug. |