/* second millisecond microsecond nanosecond Format Flags %f Fractional seconds are always used, even when their value is zero "13:15:16.000000" %F * Fractional seconds are used only when their value is not zero. "13:15:16" "05:04:03.001234" */
std::string ptime_2_str_name(boost::posix_time::ptime now) { // https://stackoverflow.com/questions/5018188/how-to-format-a-datetime-to-string-using-boost // for multiple use std::stringstream ss; //static std::locale loc(std::cout.getloc(), new time_facet("%Y%m%d_%H%M%S_%f")); static std::locale loc(ss.getloc(), new time_facet("%Y%m%d_%H%M%S_%f")); ss.imbue(loc); ss << now; return ss.str(); // 20180118_111501_208797 }
# Specify the minimum version for CMake cmake_minimum_required(VERSION 2.8)
# Project's name project(date_time)
# Set the output folder where your program will be created set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})