mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-05 10:42:51 +00:00
AK: Add conversion functions for packed DOS time format
This also adjusts the FATFS code to use the new functions and removes the now redundant old conversion functions.
This commit is contained in:
parent
7e915b145b
commit
361df6eff8
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/Ollrogge
Commit: 361df6eff8
Pull-request: https://github.com/SerenityOS/serenity/pull/17224
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/drunderscore
Reviewed-by: https://github.com/timschumi
7 changed files with 98 additions and 39 deletions
|
@ -31,9 +31,9 @@ FATInode::FATInode(FATFS& fs, FATEntry entry, NonnullOwnPtr<KString> filename)
|
|||
.uid = 0,
|
||||
.gid = 0,
|
||||
.link_count = 0,
|
||||
.atime = fat_date_time(m_entry.last_accessed_date, { 0 }),
|
||||
.ctime = fat_date_time(m_entry.creation_date, m_entry.creation_time),
|
||||
.mtime = fat_date_time(m_entry.modification_date, m_entry.modification_time),
|
||||
.atime = time_from_packed_dos(m_entry.last_accessed_date, { 0 }),
|
||||
.ctime = time_from_packed_dos(m_entry.creation_date, m_entry.creation_time),
|
||||
.mtime = time_from_packed_dos(m_entry.modification_date, m_entry.modification_time),
|
||||
.dtime = {},
|
||||
.block_count = 0,
|
||||
.block_size = 0,
|
||||
|
@ -186,14 +186,6 @@ ErrorOr<NonnullOwnPtr<KString>> FATInode::compute_filename(FATEntry& entry, Vect
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Time FATInode::fat_date_time(FATPackedDate date, FATPackedTime time)
|
||||
{
|
||||
if (date.value == 0)
|
||||
return Time();
|
||||
|
||||
return Time::from_timestamp(first_fat_year + date.year, date.month, date.day, time.hour, time.minute, time.second * 2, 0);
|
||||
}
|
||||
|
||||
StringView FATInode::byte_terminated_string(StringView string, u8 fill_byte)
|
||||
{
|
||||
if (auto index = string.find_last_not(fill_byte); index.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue