# [−][src]Struct filetime::FileTime

    pub struct FileTime { /* 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`[src]

#### `pub fn zero() -> FileTime`[src]

Creates a new timestamp representing a 0 time.

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

#### `pub fn from_unix_time(seconds: i64, nanos: u32) -> FileTime`[src]

Creates a new instance of `FileTime` with a number of seconds and nanoseconds relative to the Unix epoch, 1970-01-01T00:00:00Z.

Negative seconds represent times before the Unix epoch, and positive values represent times after it. Nanos always count forwards in time.

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.

#### `pub fn from_last_modification_time(meta: &Metadata) -> FileTime`[src]

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.

#### `pub fn from_last_access_time(meta: &Metadata) -> FileTime`[src]

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.

#### `pub fn from_creation_time(meta: &Metadata) -> Option<FileTime>`[src]

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.

#### `pub fn from_system_time(time: SystemTime) -> FileTime`[src]

Creates a new timestamp from the given SystemTime.

Windows counts file times since 1601-01-01T00:00:00Z, and cannot represent times before this, but it's possible to create a SystemTime that does. This function will error if passed such a SystemTime.

#### `pub fn seconds(&self) -> i64`[src]

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.

#### `pub fn unix_seconds(&self) -> i64`[src]

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.

#### `pub fn nanoseconds(&self) -> u32`[src]

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 Eq for FileTime`[src]

### `impl Clone for FileTime`[src]

#### `fn clone(&self) -> FileTime`[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0[src]

Performs copy-assignment from `source`. Read more

### `impl PartialOrd<FileTime> for FileTime`[src]

#### `fn partial_cmp(&self, other: &FileTime) -> Option<Ordering>`[src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `fn lt(&self, other: &FileTime) -> bool`[src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `fn le(&self, other: &FileTime) -> bool`[src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `fn gt(&self, other: &FileTime) -> bool`[src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `fn ge(&self, other: &FileTime) -> bool`[src]

This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. Read more

### `impl PartialEq<FileTime> for FileTime`[src]

#### `fn eq(&self, other: &FileTime) -> bool`[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, other: &FileTime) -> bool`[src]

This method tests for `!=`.

### `impl Ord for FileTime`[src]

#### `fn cmp(&self, other: &FileTime) -> Ordering`[src]

This method returns an `Ordering` between `self` and `other`. Read more

#### `fn max(self, other: Self) -> Self` 1.21.0[src]

Compares and returns the maximum of two values. Read more

#### `fn min(self, other: Self) -> Self` 1.21.0[src]

Compares and returns the minimum of two values. Read more

#### `fn clamp(self, min: Self, max: Self) -> Self`[src]

🔬 This is a nightly-only experimental API. (`clamp`)

Restrict a value to a certain interval. Read more

### `impl From<SystemTime> for FileTime`[src]

#### `fn from(time: SystemTime) -> FileTime`[src]

Performs the conversion.

### `impl Copy for FileTime`[src]

### `impl Hash for FileTime`[src]

#### `fn hash<__H: Hasher>(&self, state: &mut __H)`[src]

Feeds this value into the given [`Hasher`]. Read more

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

Feeds a slice of this type into the given [`Hasher`]. Read more

### `impl Debug for FileTime`[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`[src]

Formats the value using the given formatter. Read more

### `impl Display for FileTime`[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`[src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

### `impl Send for FileTime`

### `impl Unpin for FileTime`

### `impl Sync for FileTime`

### `impl UnwindSafe for FileTime`

### `impl RefUnwindSafe for FileTime`

## Blanket Implementations

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> T`[src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `fn clone_into(&self, target: &mut T)`[src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `fn into(self) -> U`[src]

Performs the conversion.

### `impl<T> From<T> for T`[src]

#### `fn from(t: T) -> T`[src]

Performs the conversion.

### `impl<T> ToString for T where
T: Display + ?Sized,` [src]

#### `default fn to_string(&self) -> String`[src]

Converts the given value to a `String`. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`[src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`[src]

Performs the conversion.

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `fn borrow_mut(&mut self) -> &mut T`[src]

Mutably borrows from an owned value. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `fn borrow(&self) -> &T`[src]

Immutably borrows from an owned value. Read more

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `fn type_id(&self) -> TypeId`[src]

Gets the `TypeId` of `self`. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)