\PhpZip\Model\Extra\FieldsExtendedTimestampExtraField

Extended Timestamp Extra Field: ==============================.

The following is the layout of the extended-timestamp extra block. (Last Revision 19970118)

Local-header version:

Value Size Description


(time) 0x5455 Short tag for this extra block type ("UT") TSize Short total data size for this block Flags Byte info bits (ModTime) Long time of last modification (UTC/GMT) (AcTime) Long time of last access (UTC/GMT) (CrTime) Long time of original creation (UTC/GMT)

Central-header version:

Value Size Description


(time) 0x5455 Short tag for this extra block type ("UT") TSize Short total data size for this block Flags Byte info bits (refers to local header!) (ModTime) Long time of last modification (UTC/GMT)

The central-header extra field contains the modification time only, or no timestamp at all. TSize is used to flag its presence or absence. But note:

If "Flags" indicates that Modtime is present in the local header field, it MUST be present in the central header field, too! This correspondence is required because the modification time value may be used to support trans-timezone freshening and updating operations with zip archives.

The time values are in standard Unix signed-long format, indicating the number of seconds since 1 January 1970 00:00:00. The times are relative to Coordinated Universal Time (UTC), also sometimes referred to as Greenwich Mean Time (GMT). To convert to local time, the software must know the local timezone offset from UTC/GMT.

The lower three bits of Flags in both headers indicate which time- stamps are present in the LOCAL extra field:

bit 0 if set, modification time is present bit 1 if set, access time is present bit 2 if set, creation time is present bits 3-7 reserved for additional timestamps; not set

Those times that are present will appear in the order indicated, but any combination of times may be omitted. (Creation time may be present without access time, for example.) TSize should equal (1 + 4*(number of set bits in Flags)), as the block is currently defined. Other timestamps may be added in the future.

Summary

Methods
Properties
Constants
__construct()
create()
getHeaderId()
unpackLocalFileData()
unpackCentralDirData()
packLocalFileData()
packCentralDirData()
getFlags()
getModifyTime()
getAccessTime()
getCreateTime()
getModifyDateTime()
getAccessDateTime()
getCreateDateTime()
setModifyTime()
setAccessTime()
setCreateTime()
__toString()
No public properties found
HEADER_ID
MODIFY_TIME_BIT
ACCESS_TIME_BIT
CREATE_TIME_BIT
No protected methods found
No protected properties found
N/A
updateFlags()
timestampToDateTime()
$flags
$modifyTime
$accessTime
$createTime
N/A

Constants

HEADER_ID

HEADER_ID = 0x5455 : int

MODIFY_TIME_BIT

MODIFY_TIME_BIT = 1 : int

ACCESS_TIME_BIT

ACCESS_TIME_BIT = 2 : int

CREATE_TIME_BIT

CREATE_TIME_BIT = 4 : int

Properties

$flags

$flags : int

Type

int — The 3 boolean fields (below) come from this flags byte. The remaining 5 bits are ignored according to the current version of the spec (December 2012).

$modifyTime

$modifyTime : int|null

Type

int|null — Modify time

$accessTime

$accessTime : int|null

Type

int|null — Access time

$createTime

$createTime : int|null

Type

int|null — Create time

Methods

__construct()

__construct(int  $flags, int|null  $modifyTime, int|null  $accessTime, int|null  $createTime) : mixed

Parameters

int $flags
int|null $modifyTime
int|null $accessTime
int|null $createTime

Returns

mixed —

create()

create(int|null  $modifyTime, int|null  $accessTime, int|null  $createTime) : \PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField

Parameters

int|null $modifyTime
int|null $accessTime
int|null $createTime

Returns

\PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField —

getHeaderId()

getHeaderId() : int

Returns the Header ID (type) of this Extra Field.

The Header ID is an unsigned short integer (two bytes) which must be constant during the life cycle of this object.

Returns

int —

unpackLocalFileData()

unpackLocalFileData(string  $buffer, \PhpZip\Model\ZipEntry|null  $entry = null) : \PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField

Populate data from this array as if it was in local file data.

Parameters

string $buffer

the buffer to read data from

\PhpZip\Model\ZipEntry|null $entry

Returns

\PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField —

unpackCentralDirData()

unpackCentralDirData(string  $buffer, \PhpZip\Model\ZipEntry|null  $entry = null) : \PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField

Populate data from this array as if it was in central directory data.

Parameters

string $buffer

the buffer to read data from

\PhpZip\Model\ZipEntry|null $entry

Returns

\PhpZip\Model\Extra\Fields\ExtendedTimestampExtraField —

packLocalFileData()

packLocalFileData() : string

The actual data to put into local file data - without Header-ID or length specifier.

Returns

string —

the data

packCentralDirData()

packCentralDirData() : string

The actual data to put into central directory - without Header-ID or length specifier.

Note: even if bit1 and bit2 are set, the Central data will still not contain access/create fields: only local data ever holds those!

Returns

string —

the data

getFlags()

getFlags() : int

Gets flags byte.

The flags byte tells us which of the three datestamp fields are present in the data: bit0 - modify time bit1 - access time bit2 - create time

Only first 3 bits of flags are used according to the latest version of the spec (December 2012).

Returns

int —

flags byte indicating which of the three datestamp fields are present

getModifyTime()

getModifyTime() : int|null

Returns the modify time (seconds since epoch) of this zip entry, or null if no such timestamp exists in the zip entry.

Returns

int|null —

modify time (seconds since epoch) or null

getAccessTime()

getAccessTime() : int|null

Returns the access time (seconds since epoch) of this zip entry, or null if no such timestamp exists in the zip entry.

Returns

int|null —

access time (seconds since epoch) or null

getCreateTime()

getCreateTime() : int|null

Returns the create time (seconds since epoch) of this zip entry, or null if no such timestamp exists in the zip entry.

Note: modern linux file systems (e.g., ext2) do not appear to store a "create time" value, and so it's usually omitted altogether in the zip extra field. Perhaps other unix systems track this.

Returns

int|null —

create time (seconds since epoch) or null

getModifyDateTime()

getModifyDateTime() : \DateTimeInterface|null

Returns the modify time as a \DateTimeInterface of this zip entry, or null if no such timestamp exists in the zip entry.

The milliseconds are always zeroed out, since the underlying data offers only per-second precision.

Returns

\DateTimeInterface|null —

modify time as \DateTimeInterface or null

getAccessDateTime()

getAccessDateTime() : \DateTimeInterface|null

Returns the access time as a \DateTimeInterface of this zip entry, or null if no such timestamp exists in the zip entry.

The milliseconds are always zeroed out, since the underlying data offers only per-second precision.

Returns

\DateTimeInterface|null —

access time as \DateTimeInterface or null

getCreateDateTime()

getCreateDateTime() : \DateTimeInterface|null

Returns the create time as a a \DateTimeInterface of this zip entry, or null if no such timestamp exists in the zip entry.

The milliseconds are always zeroed out, since the underlying data offers only per-second precision.

Note: modern linux file systems (e.g., ext2) do not appear to store a "create time" value, and so it's usually omitted altogether in the zip extra field. Perhaps other unix systems track $this->.

Returns

\DateTimeInterface|null —

create time as \DateTimeInterface or null

setModifyTime()

setModifyTime(int|null  $unixTime) : mixed

Sets the modify time (seconds since epoch) of this zip entry using a integer.

Parameters

int|null $unixTime

unix time of the modify time (seconds per epoch) or null

Returns

mixed —

setAccessTime()

setAccessTime(int|null  $unixTime) : mixed

Sets the access time (seconds since epoch) of this zip entry using a integer.

Parameters

int|null $unixTime

Unix time of the access time (seconds per epoch) or null

Returns

mixed —

setCreateTime()

setCreateTime(int|null  $unixTime) : mixed

Sets the create time (seconds since epoch) of this zip entry using a integer.

Parameters

int|null $unixTime

Unix time of the create time (seconds per epoch) or null

Returns

mixed —

__toString()

__toString() : string

Returns

string —

updateFlags()

updateFlags() : mixed

Returns

mixed —

timestampToDateTime()

timestampToDateTime(int|null  $timestamp) : \DateTimeInterface|null

Parameters

int|null $timestamp

Returns

\DateTimeInterface|null —