kubkon opened PR #1255 from filetime-in-yanix to master:
I've noticed that we could replace every occurrence of
crate::Result
infiletimemods withio::Result, so I thought why not move it
toyanixand get rid off a lot of unnecessary code duplication
withinwasi-common. Now, ideally I'd have ourfiletimemodifications
backported to @alexcrichton's [filetime] crate, but one step at a time
(apologies @alexcrichton, I was meant to backport this ages ago, just didn't
find the time yet... :-().Anyway, this commit does just that; i.e., moves the
filetimemodules
intoyanixwhich seems a better fit for this type of code.[
filetime]: https://github.com/alexcrichton/filetimeThere is one caveat here. On Emscripten, converting between
filetime::Filetime
andlibc::timespecappears to be lossy, at least as far as the
types are concerned. Now,filetime::Filetime's seconds field is
i64while nanoseconds field isu32, while Emscripten's
libc::timespecrequires both to bei32width. This might actually
not be a problem since I don't think it's possible to fillfiletime::Filetime
struct with values of width wider thani32since Emscripten is 32bit
but just to be on the safe side, we do aTryIntoconversion, log
the error (if any), and returnlibc::EOVERFLOW.Lemme know what you guys reckon!
kubkon requested alexcrichton, and sunfishcode for a review on PR #1255.
kubkon requested alexcrichton, and sunfishcode for a review on PR #1255.
kubkon updated PR #1255 from filetime-in-yanix to master:
I've noticed that we could replace every occurrence of
crate::Result
infiletimemods withio::Result, so I thought why not move it
toyanixand get rid off a lot of unnecessary code duplication
withinwasi-common. Now, ideally I'd have ourfiletimemodifications
backported to @alexcrichton's [filetime] crate, but one step at a time
(apologies @alexcrichton, I was meant to backport this ages ago, just didn't
find the time yet... :-().Anyway, this commit does just that; i.e., moves the
filetimemodules
intoyanixwhich seems a better fit for this type of code.[
filetime]: https://github.com/alexcrichton/filetimeThere is one caveat here. On Emscripten, converting between
filetime::Filetime
andlibc::timespecappears to be lossy, at least as far as the
types are concerned. Now,filetime::Filetime's seconds field is
i64while nanoseconds field isu32, while Emscripten's
libc::timespecrequires both to bei32width. This might actually
not be a problem since I don't think it's possible to fillfiletime::Filetime
struct with values of width wider thani32since Emscripten is 32bit
but just to be on the safe side, we do aTryIntoconversion, log
the error (if any), and returnlibc::EOVERFLOW.Lemme know what you guys reckon!
sunfishcode submitted PR Review.
sunfishcode submitted PR Review.
sunfishcode created PR Review Comment:
Slightly more verbose, but avoids the need for a two-line comment:
i64::from(ft.nanoseconds()):-).
kubkon submitted PR Review.
kubkon created PR Review Comment:
Excellent, thanks!
kubkon updated PR #1255 from filetime-in-yanix to master:
I've noticed that we could replace every occurrence of
crate::Result
infiletimemods withio::Result, so I thought why not move it
toyanixand get rid off a lot of unnecessary code duplication
withinwasi-common. Now, ideally I'd have ourfiletimemodifications
backported to @alexcrichton's [filetime] crate, but one step at a time
(apologies @alexcrichton, I was meant to backport this ages ago, just didn't
find the time yet... :-().Anyway, this commit does just that; i.e., moves the
filetimemodules
intoyanixwhich seems a better fit for this type of code.[
filetime]: https://github.com/alexcrichton/filetimeThere is one caveat here. On Emscripten, converting between
filetime::Filetime
andlibc::timespecappears to be lossy, at least as far as the
types are concerned. Now,filetime::Filetime's seconds field is
i64while nanoseconds field isu32, while Emscripten's
libc::timespecrequires both to bei32width. This might actually
not be a problem since I don't think it's possible to fillfiletime::Filetime
struct with values of width wider thani32since Emscripten is 32bit
but just to be on the safe side, we do aTryIntoconversion, log
the error (if any), and returnlibc::EOVERFLOW.Lemme know what you guys reckon!
kubkon updated PR #1255 from filetime-in-yanix to master:
I've noticed that we could replace every occurrence of
crate::Result
infiletimemods withio::Result, so I thought why not move it
toyanixand get rid off a lot of unnecessary code duplication
withinwasi-common. Now, ideally I'd have ourfiletimemodifications
backported to @alexcrichton's [filetime] crate, but one step at a time
(apologies @alexcrichton, I was meant to backport this ages ago, just didn't
find the time yet... :-().Anyway, this commit does just that; i.e., moves the
filetimemodules
intoyanixwhich seems a better fit for this type of code.[
filetime]: https://github.com/alexcrichton/filetimeThere is one caveat here. On Emscripten, converting between
filetime::Filetime
andlibc::timespecappears to be lossy, at least as far as the
types are concerned. Now,filetime::Filetime's seconds field is
i64while nanoseconds field isu32, while Emscripten's
libc::timespecrequires both to bei32width. This might actually
not be a problem since I don't think it's possible to fillfiletime::Filetime
struct with values of width wider thani32since Emscripten is 32bit
but just to be on the safe side, we do aTryIntoconversion, log
the error (if any), and returnlibc::EOVERFLOW.Lemme know what you guys reckon!
kubkon merged PR #1255.
Last updated: Dec 13 2025 at 21:03 UTC