Skip to content

Instantly share code, notes, and snippets.

View bschlinker's full-sized avatar

Brandon Schlinker bschlinker

View GitHub Profile
@bschlinker
bschlinker / timestampWithMs.cpp
Created February 5, 2018 18:32
Timestamp with milliseconds
#include <chrono>
#include <iomanip>
#include <iostream>
string getTimestamp() {
// get a precise timestamp as a string
const auto now = std::chrono::system_clock::now();
const auto nowAsTimeT = std::chrono::system_clock::to_time_t(now);
const auto nowMs = std::chrono::duration_cast<std::chrono::milliseconds>(
now.time_since_epoch()) % 1000;
@bschlinker
bschlinker / gist:7428815
Last active November 14, 2018 07:25
System Timer Granularity Analyzer for C
// System Timer Granularity Analysis
// Developed by: Brandon C. Schlinker (Inbound5 / Develop5)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <signal.h>
#include <sched.h>
#include <unistd.h>