Get current timestamp
| 678 | |
| 679 | // Get current timestamp |
| 680 | std::string get_timestamp() |
| 681 | { |
| 682 | auto now = std::chrono::system_clock::now(); |
| 683 | auto time_t = std::chrono::system_clock::to_time_t(now); |
| 684 | std::stringstream ss; |
| 685 | #ifdef _WIN32 |
| 686 | struct tm time_info; |
| 687 | localtime_s(&time_info, &time_t); |
| 688 | ss << std::put_time(&time_info, "%Y-%m-%d %H:%M:%S"); |
| 689 | #else |
| 690 | ss << std::put_time(std::localtime(&time_t), "%Y-%m-%d %H:%M:%S"); |
| 691 | #endif |
| 692 | return ss.str(); |
| 693 | } |
| 694 | |
| 695 | // Print usage |
| 696 | void print_usage(const char *program_name) |