refactor(archive): Turn timespec function to extension method

This commit is contained in:
Ahmad Ansori Palembani 2025-01-02 10:05:26 +07:00
parent fc87410d46
commit 1a16d84e61
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -65,10 +65,10 @@ private fun StructStat.toArchiveStat() = ArchiveEntry.StructStat().apply {
stSize = st_size
stBlksize = st_blksize
stBlocks = st_blocks
stAtim = timespec(st_atime)
stMtim = timespec(st_mtime)
stCtim = timespec(st_ctime)
stAtim = st_atime.toTimespec()
stMtim = st_mtime.toTimespec()
stCtim = st_ctime.toTimespec()
stIno = st_ino
}
private fun timespec(tvSec: Long) = ArchiveEntry.StructTimespec().also { it.tvSec = tvSec }
private fun Long.toTimespec() = ArchiveEntry.StructTimespec().also { it.tvSec = this }