This repository has been archived by the owner on Nov 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the change for two separate fd_filestat_get_impl
- Loading branch information
Showing
5 changed files
with
80 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use crate::{host, Result}; | ||
use std::convert::TryInto; | ||
use std::time::{SystemTime, UNIX_EPOCH}; | ||
pub(crate) fn systemtime_to_timestamp(st: SystemTime) -> Result<u64> { | ||
st.duration_since(UNIX_EPOCH) | ||
.map_err(|_| host::__WASI_EINVAL)? // date earlier than UNIX_EPOCH | ||
.as_nanos() | ||
.try_into() | ||
.map_err(|_| host::__WASI_EOVERFLOW) // u128 doesn't fit into u64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
|
||
mod ctx; | ||
mod fdentry; | ||
mod helpers; | ||
mod hostcalls_impl; | ||
mod sys; | ||
#[macro_use] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters