Skip to content

Instantly share code, notes, and snippets.

@insaneyilin
Created May 11, 2020 07:26
Show Gist options
  • Save insaneyilin/e7472be392aa5d8b26b200ede8b90aa4 to your computer and use it in GitHub Desktop.
Save insaneyilin/e7472be392aa5d8b26b200ede8b90aa4 to your computer and use it in GitHub Desktop.
format unix timestamp to string
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
// e.g. 1584773265.928826
std::stringstream oss;
oss << std::setfill('0') << std::setw(17) << std::fixed
<< std::setprecision(6) << timestamp << ".png";
std::string filename = oss.str();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment