1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Fix/add details about the ExtTime structure

This commit is contained in:
Andre Brait 2022-03-04 16:44:33 +01:00 committed by GitHub
parent bab0864bf8
commit fb0e5ff9b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,7 +153,7 @@ PackSize 4 bytes
UnpSize 4 bytes UnpSize 4 bytes
HostOS 1 byte HostOS 1 byte
FileCRC 4 bytes FileCRC 4 bytes
FileTime 4 bytes FileTime (mtime) 4 bytes (MS-DOS date/time format)
UnpVer 1 byte UnpVer 1 byte
Method 1 byte Method 1 byte
NameSize 2 bytes NameSize 2 bytes
@ -171,39 +171,63 @@ Packed Data (Total Packed Size) bytes
<header> <header>
<h6 id="ext-time-structure"><a href="#ext-time-structure">ExtTime Structure</a></h6> <h6 id="ext-time-structure"><a href="#ext-time-structure">ExtTime Structure</a></h6>
</header> </header>
<p>This structure has 4 sections representing additional time data.</p>
<p>The first 16 bits contain a set of flags, 4 bits for each section.</p>
<p>Each flag contains:</p>
<ul>
<li>Bit 0: Whether this section is present or not</li>
<li>Bit 1 and 2: The amount of bytes to be read as the remainder, between 0 and 3</li>
<li>Bit 4: Signals that the MS-DOS date/time should have its seconds increased by 1</li>
<ul>
<li>MS-DOS date/time format can only store even numbers of seconds. This bit counters this limitation.</li>
</ul>
</ul>
<p>Each section contains:</p>
<ul>
<li>4 bytes containing an MS-DOS date/time (except for mtime, which is part of FILE_HEAD)</li>
<li>0 to 3 bytes containing fractions of seconds in 100ns increments</li>
</ul>
<p>Follow the following pseudo-code to read in the ExtTime Structure.</p> <p>Follow the following pseudo-code to read in the ExtTime Structure.</p>
<p><strong>TODO: Fill in details of what this structure represents.</strong></p>
<pre> <pre>
const one_second = 10000000; // 1 second in 100ns intervals => 1E7
var extTimeFlags = readBits(16) var extTimeFlags = readBits(16)
<b>mtime:</b> <b>mtime:</b>
mtime_rmode = extTimeFlags >> 12 mtime_rmode = extTimeFlags >> 12
if ((mtime_rmode & 8)==0) goto ctime if ((mtime_rmode & 8)==0) goto ctime
mtime_count = mtime_rmode & 0x3 mtime_count = mtime_rmode & 0x3
mtime_reminder = readBits(8*mtime_count); mtime_remainder = readBits(8*mtime_count);
if ((mtime_rmode & 4)!=0) mtime_remainder += one_second
<b>ctime:</b> <b>ctime:</b>
ctime_rmode = extTimeFlags >> 8 ctime_rmode = extTimeFlags >> 8
if ((ctime_rmode & 8)==0) goto atime if ((ctime_rmode & 8)==0) goto atime
Set ctime to readBits(16) Set ctime to readBits(32)
ctime_count = ctime_rmode & 0x3 ctime_count = ctime_rmode & 0x3
ctime_reminder = readBits(8*ctime_count) ctime_remainder = readBits(8*ctime_count)
if ((ctime_rmode & 4)!=0) ctime_remainder += one_second
<b>atime:</b> <b>atime:</b>
atime_rmode = extTimeFlags >> 4 atime_rmode = extTimeFlags >> 4
if ((atime_rmode & 8)==0) goto arctime if ((atime_rmode & 8)==0) goto arctime
Set atime to readBits(16) Set atime to readBits(32)
atime_count = atime_rmode & 0x3 atime_count = atime_rmode & 0x3
atime_reminder = readBits(8*atime_count) atime_remainder = readBits(8*atime_count)
if ((atime_rmode & 4)!=0) atime_remainder += one_second
<b>arctime:</b> <b>arctime:</b>
arctime_rmode = extTimeFlags arctime_rmode = extTimeFlags
if ((arctime_rmode & 8)==0) goto done_exttime if ((arctime_rmode & 8)==0) goto done_exttime
Set arctime to readBits(16) Set arctime to readBits(32)
arctime_count = arctime_rmode & 0x3 arctime_count = arctime_rmode & 0x3
arctime_reminder = readBits(8*arctime_count) arctime_remainder = readBits(8*arctime_count)
if ((arctime_rmode & 4)!=0) arctime_remainder += one_second
<b>done_exttime</b> <b>done_exttime</b>
</pre> </pre>
@ -555,4 +579,4 @@ ZeroCount 4 bits (only present if BitLength is 15)
</section> </section>
</body> </body>
</html> </html>