From 1a16d84e61bc9f09a6b22c9ed5f37d2ef5d0e96d Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Thu, 2 Jan 2025 10:05:26 +0700 Subject: [PATCH] refactor(archive): Turn timespec function to extension method --- .../archive/src/main/java/yokai/core/archive/ZipWriter.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/archive/src/main/java/yokai/core/archive/ZipWriter.kt b/core/archive/src/main/java/yokai/core/archive/ZipWriter.kt index 3ee02b02b7..9a776e106c 100644 --- a/core/archive/src/main/java/yokai/core/archive/ZipWriter.kt +++ b/core/archive/src/main/java/yokai/core/archive/ZipWriter.kt @@ -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 }