diff options
Diffstat (limited to 'src/tools/imgtool/modules/cybikoxt.cpp')
-rw-r--r-- | src/tools/imgtool/modules/cybikoxt.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/tools/imgtool/modules/cybikoxt.cpp b/src/tools/imgtool/modules/cybikoxt.cpp index a649dbe8909..8c2980de449 100644 --- a/src/tools/imgtool/modules/cybikoxt.cpp +++ b/src/tools/imgtool/modules/cybikoxt.cpp @@ -55,17 +55,8 @@ static cybiko_file_system *get_cfs(imgtool::image &image) return (cybiko_file_system*)image.extra_bytes(); } -// 2208988800 is the number of seconds between 1900/01/01 and 1970/01/01 - -static time_t time_crack( uint32_t cfs_time) -{ - return (time_t)(cfs_time - 2208988800UL); -} - -static uint32_t time_setup( time_t ansi_time) -{ - return (uint32_t)(ansi_time + 2208988800UL); -} +extern imgtool::datetime cybiko_time_crack(uint32_t cfs_time); +extern uint32_t cybiko_time_setup(const imgtool::datetime &t); static uint32_t buffer_read_32_be( uint8_t *buffer) { @@ -382,7 +373,7 @@ static imgtoolerr_t cybiko_image_next_enum(imgtool::directory &enumeration, imgt { strcpy(ent.filename, file.name); ent.filesize = file.size; - ent.lastmodified_time = time_crack(file.date); + ent.lastmodified_time = cybiko_time_crack(file.date); ent.filesize = file.size; } else @@ -475,7 +466,7 @@ static imgtoolerr_t cybiko_image_write_file(imgtool::partition &partition, const { buffer[6] = 0x20; strcpy(BLOCK_FILENAME(buffer), filename); - buffer_write_32_be( buffer + 6 + FILE_HEADER_SIZE - 4, time_setup( time( NULL))); + buffer_write_32_be( buffer + 6 + FILE_HEADER_SIZE - 4, cybiko_time_setup(imgtool::datetime::now(imgtool::datetime::datetime_type::LOCAL))); sourcef.read(buffer + 6 + FILE_HEADER_SIZE, buffer[1]); } else |