diff options
author | Bert Belder <bertbelder@gmail.com> | 2020-04-27 20:09:56 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2020-04-27 21:13:32 +0200 |
commit | ee4e6a1ef9f51beaaef5e189302afe1db68ff6c1 (patch) | |
tree | d0a94be76718630b210c481e9b0f3171542b4007 /std/archive | |
parent | c190a0dbc48e7de6a63a2f633f59054d40800600 (diff) |
Rename FileInfo time fields and represent them as Date objects (#4932)
This patch also increases the resolution of reported file times to
sub-millisecond precision.
Diffstat (limited to 'std/archive')
-rw-r--r-- | std/archive/tar.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/std/archive/tar.ts b/std/archive/tar.ts index 699b982a9..28c4bbd9a 100644 --- a/std/archive/tar.ts +++ b/std/archive/tar.ts @@ -317,10 +317,9 @@ export class Tar { const mode = opts.fileMode || (info && info.mode) || parseInt("777", 8) & 0xfff, - mtime = - opts.mtime || - (info && info.modified) || - Math.floor(new Date().getTime() / 1000), + mtime = Math.floor( + opts.mtime ?? (info?.mtime ?? new Date()).valueOf() / 1000 + ), uid = opts.uid || 0, gid = opts.gid || 0; if (typeof opts.owner === "string" && opts.owner.length >= 32) { |