diff options
Diffstat (limited to 'src/administration_writer.cpp')
| -rw-r--r-- | src/administration_writer.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/administration_writer.cpp b/src/administration_writer.cpp index c27b3e3..b08723b 100644 --- a/src/administration_writer.cpp +++ b/src/administration_writer.cpp @@ -522,11 +522,22 @@ bool administration_writer_save_project_blocking(project project) int buf_length = 0; char* file_content = administration_writer_copy_template(project_save_template, &buf_length); + struct tm *tm_info = 0; + char date_buffer[11]; // "YYYY-MM-DD" + null terminator + + + strops_replace(file_content, buf_length, "{{PROJECT_ID}}", project.id); strops_replace(file_content, buf_length, "{{PROJECT_DESCRIPTION}}", project.description); strops_replace_int32(file_content, buf_length, "{{PROJECT_STATE}}", project.state); - strops_replace_int64(file_content, buf_length, "{{PROJECT_STARTDATE}}", (long long)project.start_date); - strops_replace_int64(file_content, buf_length, "{{PROJECT_ENDDATE}}", (long long)project.end_date); + + tm_info = gmtime(&project.start_date); + strftime(date_buffer, sizeof(date_buffer), "%Y-%m-%d", tm_info); + strops_replace(file_content, buf_length, "{{PROJECT_STARTDATE}}", date_buffer); + + tm_info = gmtime(&project.end_date); + strftime(date_buffer, sizeof(date_buffer), "%Y-%m-%d", tm_info); + strops_replace(file_content, buf_length, "{{PROJECT_ENDDATE}}", date_buffer); //// Write to Disk. char final_path[50]; |
