Struct filetime::FileTime [] [src]

pub struct FileTime {
    // some fields omitted
}

A helper structure to represent a timestamp for a file.

The actual value contined within is platform-specific and does not have the same meaning across platforms, but comparisons and stringification can be significant among the same platform.

Methods

impl FileTime

fn zero() -> FileTime

Creates a new timestamp representing a 0 time.

Useful for creating the base of a cmp::max chain of times.

fn from_seconds_since_1970(seconds: u64, nanos: u32) -> FileTime

Creates a new instance of FileTime with a number of seconds and nanoseconds relative to January 1, 1970.

Note that this is typically the relative point that Unix time stamps are from, but on Windows the native time stamp is relative to January 1, 1601 so the return value of seconds from the returned FileTime instance may not be the same as that passed in.

fn from_last_modification_time(meta: &Metadata) -> FileTime

Creates a new timestamp from the last modification time listed in the specified metadata.

The returned value corresponds to the mtime field of stat on Unix platforms and the ftLastWriteTime field on Windows platforms.

fn from_last_access_time(meta: &Metadata) -> FileTime

Creates a new timestamp from the last access time listed in the specified metadata.

The returned value corresponds to the atime field of stat on Unix platforms and the ftLastAccessTime field on Windows platforms.

fn from_creation_time(meta: &Metadata) -> Option<FileTime>

Creates a new timestamp from the creation time listed in the specified metadata.

The returned value corresponds to the birthtime field of stat on Unix platforms and the ftCreationTime field on Windows platforms. Note that not all Unix platforms have this field available and may return None in some circumstances.

fn seconds(&self) -> u64

Returns the whole number of seconds represented by this timestamp.

Note that this value's meaning is platform specific. On Unix platform time stamps are typically relative to January 1, 1970, but on Windows platforms time stamps are relative to January 1, 1601.

fn seconds_relative_to_1970(&self) -> u64

Returns the whole number of seconds represented by this timestamp, relative to the Unix epoch start of January 1, 1970.

Note that this does not return the same value as seconds for Windows platforms as seconds are relative to a different date there.

fn nanoseconds(&self) -> u32

Returns the nanosecond precision of this timestamp.

The returned value is always less than one billion and represents a portion of a second forward from the seconds returned by the seconds method.

Trait Implementations

impl Display for FileTime

fn fmt(&self, f: &mut Formatter) -> Result

Derived Implementations

impl Hash for FileTime

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Clone for FileTime

fn clone(&self) -> FileTime

fn clone_from(&mut self, source: &Self)

impl Copy for FileTime

impl Debug for FileTime

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl PartialOrd for FileTime

fn partial_cmp(&self, __arg_0: &FileTime) -> Option<Ordering>

fn lt(&self, __arg_0: &FileTime) -> bool

fn le(&self, __arg_0: &FileTime) -> bool

fn gt(&self, __arg_0: &FileTime) -> bool

fn ge(&self, __arg_0: &FileTime) -> bool

impl Ord for FileTime

fn cmp(&self, __arg_0: &FileTime) -> Ordering

impl PartialEq for FileTime

fn eq(&self, __arg_0: &FileTime) -> bool

fn ne(&self, __arg_0: &FileTime) -> bool

impl Eq for FileTime