Skip to content

Instantly share code, notes, and snippets.

@smassung
Created December 18, 2015 23:15
Show Gist options
  • Save smassung/99a48651d83891763421 to your computer and use it in GitHub Desktop.
Save smassung/99a48651d83891763421 to your computer and use it in GitHub Desktop.
SVN Simulator 1.0
/**
* @file svn_simulator.cpp
* @author Sean Massung
* clang++ -std=c++14 -stdlib=libc++ -lc++abi svn_simulator.cpp -o svn
*/
#include <chrono>
#include <thread>
#include <iostream>
#include <random>
template <class FileSize, class FileID>
void upload_file(FileSize&& file_size, FileID&& file_id)
{
auto size = file_size(file_id);
std::chrono::milliseconds file_upload_time{static_cast<uint64_t>(size)};
std::this_thread::sleep_for(file_upload_time);
}
int main(int argc, char* argv[])
{
std::cout << "Transmitting file data ";
std::default_random_engine gen;
std::normal_distribution<> dist(160, 70);
while (true)
{
std::cout << "." << std::flush;
upload_file(dist, gen);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment