Skip to content

Commit

Permalink
convert timestamp to date time
Browse files Browse the repository at this point in the history
  • Loading branch information
HookedBehemoth committed May 6, 2020
1 parent 2141b1e commit 298aa5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,15 @@ Result Capture() {
/* I don't care if any of this fails. */
FsTimeStampRaw timestamp;
if (R_SUCCEEDED(fsFsGetFileTimeStampRaw(&fs, path_buffer, &timestamp))) {
std::snprintf(b_path_buffer, FS_MAX_PATH, "/Bitmaps/%ld.bmp", timestamp.created);
time_t ts = timestamp.created;
tm *t = localtime(&ts);
std::snprintf(b_path_buffer, FS_MAX_PATH, "/Bitmaps/%d-%02d-%02d_%02d-%02d-%02d.bmp",
t->tm_year + 1900,
t->tm_mon + 1,
t->tm_mday,
t->tm_hour,
t->tm_min,
t->tm_sec);
fsFsRenameFile(&fs, path_buffer, b_path_buffer);
}

Expand Down

0 comments on commit 298aa5d

Please sign in to comment.