Skip to content

Commit

Permalink
Update getCurrentTimestamp
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Gracioso <[email protected]>
  • Loading branch information
lbgracioso committed Jun 19, 2024
1 parent 05dd210 commit 2466469
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ void removeFile(std::string_view filename)
*/
std::string getCurrentTimestamp()
{
auto now = std::chrono::system_clock::now();
auto time_t_now = std::chrono::system_clock::to_time_t(now);
std::stringstream ss;
ss << std::put_time(std::localtime(&time_t_now), "%Y%m%d_%H%M%S");
return ss.str();
time_t now;
time(&now);
char buf[sizeof "2011-10-08T07:07:09Z"];
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&now));
return buf;
}

/* Backup file */
Expand Down

0 comments on commit 2466469

Please sign in to comment.